private async Task <IdentityUser> FindUser(AuthenticateResult result)
        {
            // For create flow when we have user-id present
            if (result.Properties.Items.TryGetValue("userId", out var userId) && userId != null)
            {
                return(await _userManager.FindByIdAsync(userId));
            }

            // For login flow when we do not have a user-id
            var email = result.Principal.Claims.FindEmail();

            if (email != null)
            {
                return(await _userManager.FindByEmailAsync(email));
            }

            return(null);
        }