public async Task <IActionResult> SetApprovedLimits([FromRoute] long applicationNumber, [FromRoute] int arrangementRequestId, [FromBody] ApprovedLimits command) { try { var application = await _applicationRepository.GetAsync(applicationNumber); if (application == null) { return(NotFound()); } var setApprovedLimits = await _arrangementRequestRepository .SetApprovedLimits(applicationNumber, arrangementRequestId, command, application); if (setApprovedLimits == null) { return(NotFound()); } return(Ok()); } catch (KeyNotFoundException e) { this._logger.LogError(e, "An error occurred while updating Arrangement Request for arrangementRequestId {arrangementRequestId} on application {ApplicationNumber}", arrangementRequestId, applicationNumber); return(BadRequest(new { message = e.Message })); } catch (Exception e) { this._logger.LogError(e, "An error occurred while updating Arrangement Request for arrangementRequestId {arrangementRequestId} on application {ApplicationNumber}", arrangementRequestId, applicationNumber); return(StatusCode(500)); } }