public BaseResponse <object> UsePasswordReset(UsePasswordResetRequest request)
        {
            BaseResponse <object> response = new BaseResponse <object>();

            var passwordReset = this.PasswordResetRepository.GetPasswordReset(request.Token);

            if (this.IsPasswordResetEligibleForUse(passwordReset))
            {
                var user = this.UserRepository.GetUser(passwordReset.UserKey);

                if (this.IsUserEligibleForRequestPasswordReset(user))
                {
                    var passwordHash = HashUtility.GenerateSha256(request.Password, this.ConfigurationUtility.HashGap);
                    this.UserRepository.UpdateUserPassword(user.UserKey, passwordHash);
                    this.PasswordResetRepository.UsePasswordReset(request.Token);

                    response.StatusCode = HttpStatusCode.OK;
                    response.IsSuccess  = true;
                    return(response);
                }
            }

            response.StatusCode = HttpStatusCode.NotFound;

            return(response);
        }
        public BaseResponse <object> UsePasswordReset(UsePasswordResetRequest request)
        {
            BaseResponse <object> response = new BaseResponse <object>();

            IRestRequest restRequest = new RestRequest("password-resets/{token}", Method.PUT);

            restRequest.AddUrlSegment("token", request.Token);
            restRequest.RequestFormat = DataFormat.Json;
            restRequest.AddJsonBody(request);

            IRestResponse restResponse = this.RestClient.Execute(restRequest);

            return(this.HandleResponse <object>(restResponse));
        }