public async Task<ActionResult> LoginConfirmation(LoginConfirmationViewModel model, string returnUrl)
		{
			if (User.Identity.IsAuthenticated)
			{
				return Redirect(returnUrl);
			}

			if (ModelState.IsValid)
			{
				// Get the information about the user from the external login provider
				var info = await AuthenticationManager.GetExternalLoginInfoAsync();
				if (info == null)
				{
					return View("LoginFailure");
				}
				var user = new UserAccount { UserName = model.UserName, PlayerGuid = Guid.NewGuid() };
				var result = await _userManager.CreateAsync(user);
				if (result.Succeeded)
				{
					result = await _userManager.AddLoginAsync(user.Id, info.Login);
					if (result.Succeeded)
					{
						await SignInAsync(user);
						return Redirect(returnUrl);
					}
				}
				AddErrors(result);
			}

			ViewBag.ReturnUrl = returnUrl;
			return View(model);
		}
		private async Task SignInAsync(UserAccount user)
		{
			AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);

			var identity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);

			if (!identity.HasClaim(c => c.Type == ClaimTypes.Email))
			{
				var externalId = await AuthenticationManager.GetExternalIdentityAsync(DefaultAuthenticationTypes.ExternalCookie);

				if (externalId.HasClaim(c => c.Type == ClaimTypes.Email))
				{
					_userManager.AddClaim(identity.GetUserId(), externalId.Claims.First(claim => claim.Type == ClaimTypes.Email));
				}
			}

			AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = true }, identity);
		}