public async Task <IActionResult> Register(Registration registration) { if (!ModelState.IsValid) { return(View(registration)); } var fbUser = await _firebaseAuthService.Register(registration); if (fbUser == null) { ModelState.AddModelError(string.Empty, "Unable to register, do you already have an account?"); return(View(registration)); } var newUserProfile = new UserProfile { Email = fbUser.Email, FirebaseUserId = fbUser.FirebaseUserId, }; _userProfileRepository.Add(newUserProfile); await LoginToApp(newUserProfile); return(RedirectToAction("Index", "Home")); }