public CommunicationResponse UpdatePayment([FromBody] Core.Bills.Models.UpdatePaymentRequest paymentRequest) { var response = new CommunicationResponse(); try { if (_userService.AuthenticateSession(Request.Headers["Authorization"].ToString()) == false) { response.AddError("The authorization credentails were invalid", ErrorCode.SESSION_INVALID); return(response); } PaymentValidator.CheckIfValidPayment(paymentRequest); _billRepository.UpdatePayment(paymentRequest); response.Notifications = new List <string> { "The payment has been updated" }; } catch (ErrorCodeException exception) { response.AddError($"An unexpected exception occured: {exception}", paymentRequest, exception.Code); } catch (Exception exception) { response.AddError($"An unexpected exception occured: {exception}", paymentRequest); } return(response); }