public HttpResponseMessage PostForm([FromBody] PostFormDTO newForm) { string userId = ((ClaimsPrincipal)RequestContext.Principal).FindFirst(x => x.Type == "UserId").Value; logger.Info("UserId: " + userId + ": Requesting Form Insert"); try { FormDTOForAdmin saved = formsService.Create(newForm); if (saved == null) { logger.Info("Failed!"); return(Request.CreateResponse(HttpStatusCode.BadRequest, "Failed! Something went wrong.")); } logger.Info("Success!"); return(Request.CreateResponse(HttpStatusCode.OK, saved)); } catch (Exception e) { logger.Error(e); return(Request.CreateResponse(HttpStatusCode.BadRequest, e)); } }