public void InsertOrUpdate(Feature feature)
 {
     if (feature.FeatureID == default(int)) {
         // New entity
         context.Features.Add(feature);
     } else {
         // Existing entity
         context.Entry(feature).State = EntityState.Modified;
     }
 }
        public ActionResult Edit(Feature feature)
        {
            if (ModelState.IsValid) {
                featureRepository.InsertOrUpdate(feature);
                featureRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }