public IActionResult Post([FromBody] BranchModel branchModel) { if (branchModel == null) { return(BadRequest()); } TryValidateModel(branchModel); if (this.ModelState.IsValid) { var branch = _branchesService.Create(branchModel); return(CreatedAtRoute("GetBranch", new { controller = "Branches", id = branch.Id }, branch)); } else { return(BadRequest()); } }