public ActionResult Add([Bind(Include = "Code,Description,UnitsOfMeasure,QtyOnHand")] ToolDetailVM toolVM) { if (ModelState.IsValid) { try { _toolService.Add(toolVM); return(Json(new { success = true, model = toolVM })); } catch (Exception ex) { if (ex.Message.Contains("IX_Code")) { ModelState.AddModelError("Code", "This Tool Number already exists. Duplicate Tool Numbers are not allowed."); } else { ModelState.AddModelError(string.Empty, "The save failed."); } } } return(JsonErrorResult()); }