public async Task <ActionResult> Join(AccountSignupVM model) { try { if (ModelState.IsValid) { var accountExists = await userAccountManager.GetUser(model.Email); if (accountExists == null) { var newUser = new UserAccountDto { EmailAddress = model.Email, Name = model.Name, Password = model.Password }; var userSession = await userAccountManager.CreateAccount(newUser); if (userSession.UserId > 0) { userSessionHelper.SetUserIDToSession(userSession); } if (!String.IsNullOrEmpty(model.ReturnUrl)) { return(RedirectToAction("joinmyteam", "users", new { id = model.ReturnUrl })); } return(RedirectToAction("accountcreated")); } else { ModelState.AddModelError("", "Account already exists with this email address"); } } } catch (Exception ex) { } return(View(model)); }