public async Task <IdentityResult> RegisterAsync(UserRegisterServiceModel userRegisterServiceModel) { User user = _mapper.Map <UserRegisterServiceModel, User>(userRegisterServiceModel); bool exists = await _uow.GetRepository <User>().ExistsAsync(u => u.Email == user.Email); if (exists) { return(IdentityResult.Failed(new IdentityError { Code = "DuplicateEmail" })); } IdentityResult result = await _userManager.CreateAsync(user, userRegisterServiceModel.Password); //create default calendar await _calendarService.AddAsync(new CalendarCreationServiceModel { Title = "Default", Description = "", UserId = user.Id }); return(result); }