public async Task <IHttpActionResult> Post(Location value) { try { var id = await _locationService.AddOrUpdate(value); value.Id = id; } catch (ArgumentNullException e) { return(BadRequest(e.Message)); } catch (InvalidOperationException e) { var response = Request.CreateResponse(HttpStatusCode.Conflict, e.Message); throw new HttpResponseException(response); } catch (Exception e) { return(InternalServerError(e)); } return(Ok(value)); }