public IHttpActionResult Post(PolicyDto policyDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } PolicyDto policyDtoAdded = new PolicyDto(); try { policyDtoAdded = policyService.Add(policyDto); } #region Exceptions & Log catch (VuelingException e) { Log.Error(ResourceApi.AddError + e.InnerException + ResourceApi.ErrorLogSeparation + e.Message + ResourceApi.ErrorLogSeparation + e.Data + ResourceApi.ErrorLogSeparation + e.StackTrace); var response = new HttpResponseMessage(HttpStatusCode.NotFound); throw new HttpResponseException(response); #endregion } return(CreatedAtRoute(ResourceApi.HttpRoute, new { id = policyDtoAdded.Id }, policyDtoAdded)); }