public ActionResult Create([Bind(Include = "Company_Id,Company_Name,IsActive,Company_Contacts,Company_Admin,CompanyColor")] CompanyTO company) { if (company.Company_Name != "" && company.CompanyColor != "") { var Color_exist = cmpRepo.getAllCompanies().Where(x => x.CompanyColor == company.CompanyColor).FirstOrDefault(); if (Color_exist != null && Color_exist.Company_Id != company.Company_Id) { ModelState.AddModelError(string.Empty, "Please choose different color"); return(View(company)); } //logic to enter the users else { cmpRepo.saveCompany(company); } return(RedirectToAction("Index")); } return(View(company)); }