public async Task Register() { var identityResult = await userService.RegisterAsync(UserName, Password); if (identityResult.Succeeded) { await SignIn(); var user = await userService.GetUser(UserName); directoryService.CreateUserRootDirectory(user); } else { var modelErrors = ConvertIdentityErrorsToModelErrors(identityResult); Context.ModelState.Errors.AddRange(modelErrors); Context.FailOnInvalidModelState(); } Context.RedirectToRoute("Default", allowSpaRedirect: false); }