/**
  * @param User                  $user     User
  * @param UserResponseInterface $response User response interface
  */
 public function connect(UserInterface $user, UserResponseInterface $response)
 {
     $username = $response->getUsername();
     $property = $this->getProperty($response);
     /** @var User $previousUser */
     $previousUser = $this->userManager->findUserBy([$property => $username]);
     $service = $response->getResourceOwner()->getName();
     switch ($service) {
         case 'vkontakte':
             if (null !== $previousUser) {
                 $previousUser->setVkId(null);
                 $previousUser->setVkAccessToken(null);
             }
             $user->setVkId($username);
             $user->setVkAccessToken($response->getAccessToken());
             $this->userManager->updateUser($previousUser);
             break;
         case 'facebook':
             if (null !== $previousUser) {
                 $previousUser->setFacebookId(null);
                 $previousUser->setFacebookAccessToken(null);
             }
             $user->setFacebookId($username);
             $user->setFacebookAccessToken($response->getAccessToken());
             $this->userManager->updateUser($previousUser);
             break;
         case 'google':
             if (null !== $previousUser) {
                 $previousUser->setGoogleId(null);
                 $previousUser->setGoogleAccessToken(null);
             }
             $user->setGoogleId($username);
             $user->setGoogleAccessToken($response->getAccessToken());
             $this->userManager->updateUser($previousUser);
             break;
     }
     $this->userManager->updateUser($user);
 }