public HttpResponseMessage AddUpdateProfile(AddUpworkProfileDomainModel model) { HttpResponseMessage httpResponse = new HttpResponseMessage(); try { var response = ProfileRepository.AddProfile(model); if (response == null) { httpResponse = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error Occurred"); } else if (!response.isSuccess) { httpResponse = Request.CreateResponse(HttpStatusCode.NotImplemented, response); } else { httpResponse = Request.CreateResponse(HttpStatusCode.OK, response); } return(httpResponse); } catch (Exception ex) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "An error occurred, please try again or contact the administrator.", StatusCode = HttpStatusCode.InternalServerError }); } }