public IActionResult PostInitialProcessDocument([FromBody] PostInitialProcessDocumentRequest request) { //validate request var isRequestValid = _postValidator.Validate(request); if (isRequestValid.IsValid) { try { PostInitialProcessDocumentResponse usecaseResponse = _processDataUsecase.ExecutePost(request); return(StatusCode(201, usecaseResponse)); } catch (ConflictException ex) { return(Conflict("An error inserting an object with duplicate key has occured - " + ex.InnerException)); } catch (Exception ex) { return(StatusCode(500, "An error has occurred - " + ex.InnerException)); } } return(BadRequest(isRequestValid.Errors)); }