public IHttpActionResult PostParent(Parent parent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Parent createdParent = parentsService.InsertParent(parent); return(CreatedAtRoute("PostParent", new { id = parent.Id }, createdParent)); }