public IHttpActionResult EditRecurringGift([FromUri] int recurringGiftId, [FromBody] RecurringGiftDto editGift, [FromUri(Name = "impersonateDonorId")] int?impersonateDonorId = null) { editGift.RecurringGiftId = recurringGiftId; return(Authorized(token => { var impersonateUserId = impersonateDonorId == null ? string.Empty : _mpDonorService.GetEmailViaDonorId(impersonateDonorId.Value).Email; try { var donor = (impersonateDonorId != null) ? _impersonationService.WithImpersonation(token, impersonateUserId, () => _donorService.GetContactDonorForAuthenticatedUser(token)) : _donorService.GetContactDonorForAuthenticatedUser(token); var recurringGift = !string.IsNullOrWhiteSpace(impersonateUserId) ? _impersonationService.WithImpersonation(token, impersonateUserId, () => _donorService.EditRecurringGift(token, editGift, donor)) : _donorService.EditRecurringGift(token, editGift, donor); return Ok(recurringGift); } catch (PaymentProcessorException stripeException) { return (stripeException.GetStripeResult()); } catch (ApplicationException applicationException) { var apiError = new ApiErrorDto("Error calling Ministry Platform " + applicationException.Message, applicationException); throw new HttpResponseException(apiError.HttpResponseMessage); } })); }