public ActionResult Create(EventCreateModel model) { if (ModelState.IsValid) { try { using (var db = new MySelfieEntities()) { Event theEvent; if (model.EventId == 0) { theEvent = new Event(); theEvent.MergeWithOtherType(model); db.Events.Add(theEvent); } else { theEvent = db.Events.Where(x => x.EventId == model.EventId).FirstOrDefault(); theEvent.MergeWithOtherType(model); } db.SaveChanges(); } } catch (Exception ex) { ModelState.AddModelError("ex", ex); return View(model); } return RedirectToAction("Index", "Event"); } return View(model); }