I am a New York resident working for Connecticut company. Do I have to pay taxes to both NY and Connecticut?

In 01/17 I was a resident of New York and in 06/17 I changed my job from a NY company to a Connecticut company. On 08/17 I moved to Connecticut and changed my residency. During the two month overlap (from 06/17 to 08/17), I was NY resident with a CT job. How do I avoid paying double taxes in Turbo Tax. 

How do I tell NY that I already paid the CT state tax during the two month overlap.