public ActionResult Create(SampleDataViewModel viewModel) { if (!ModelState.IsValid) { return View(viewModel); } using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject())) { SampleDataService service = new SampleDataService(db); service.Add(this._toBusinessModel(viewModel)); db.SaveChanges(); } return RedirectToAction("Index"); }