public async Task <IActionResult> FirstExternalLogin()
        {
            var loginInfo = await _userService.GetExternalLoginInfoAsync();

            if (loginInfo == null)
            {
                return(RedirectToAction("Login"));
            }

            var email = loginInfo.Principal.FindFirstValue(ClaimTypes.Email);

            var register = await _userService.CreateUserAsync(email);

            if (register.Succeeded)
            {
                register = await _userService.AddLoginAsync(email, loginInfo);

                if (register.Succeeded)
                {
                    var createdUser = await _userService.GetUserByNameAsync(email);

                    var token = await _userService.GetEmailTokenAsync(createdUser);

                    var callbackUrl = Url.EmailConfirmationLink(createdUser.Id, token, Request.Scheme);

                    await _emailService.SendEmailAsync(createdUser.Email, "Confirm your account",
                                                       $"Confirm the registration by clicking on the <a href='{callbackUrl}'>link</a>");

                    await _userService.SignInUserAsync(createdUser, false);

                    return(Content("Check the email and click on the link in the letter to complete the registration"));
                }
            }

            return(RedirectToAction("Login", "Account"));
        }