public function handleLoginRequest(LoginRequest $request)
    {
        $socialLogin = $this->socialLoginMapper->findByProviderUserId(
            $request->getProvider(),
            $request->getProviderUserId()
        );

        if ($socialLogin) {
            $user = $this->userService->findById(
                $socialLogin->getUserId()
            );
            $this->updateSocialLoginToken($socialLogin, $request);
            return $this->handleLogin($user, $request);
        }

        $userFound = false;
        foreach ($request->getEmails() as $email) {
            $user = $this->userService->findByEmail($email);

            if ($user) {
                $userFound = true;
                if ($this->userHasSocialLoginWithProvider($request->getProvider(), $user)) {
                    return $this->handleLogin($user, $request);
                }
            }
        }

        if ($userFound) {
            throw new NoLinkedAccountException;
        }

        $result = $this->registerFromSocialLogin($request);

        return $this->handleLogin($result['user']);
    }