public void InsertOrUpdate(Phone phone)
 {
     if (phone.Id == default(int)) {
         // New entity
         context.Phones.Add(phone);
     } else {
         // Existing entity
         context.Entry(phone).State = EntityState.Modified;
     }
 }
 public ActionResult Create(Phone phone)
 {
     if (ModelState.IsValid) {
         phoneRepository.InsertOrUpdate(phone);
         phoneRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossiblePeople = personRepository.All;
         return View();
     }
 }