public BaseResponse <GetPasswordResetResponse> CreatePasswordReset(CreatePasswordResetRequest request) { BaseResponse <GetPasswordResetResponse> response = new BaseResponse <GetPasswordResetResponse>(); var user = this.UserRepository.GetUser(request.Email); if (this.IsUserEligibleForRequestPasswordReset(user)) { this.PasswordResetRepository.CancelActivesPasswordResets(user.UserKey); var passwordReset = PasswordReset.New(user.UserKey, this.ConfigurationUtility.PasswordResetExpiresInHours); this.PasswordResetRepository.CreatePasswordReset(passwordReset); response.StatusCode = HttpStatusCode.Created; response.SuccessBody = PasswordResetMapper.Map(passwordReset, user); response.IsSuccess = true; } else { response.StatusCode = HttpStatusCode.NotFound; } return(response); }