public HttpResponseMessage Post(BookViewModel entity) { try { var model = entity.MapOrDefault(); var result = service.CreateOrUpdate(model); return(Request.CreateResponse(HttpStatusCode.Created, result)); } catch (Exception ex) { HttpError err = new HttpError(ex.Message); return(Request.CreateResponse(HttpStatusCode.Conflict, err)); } }