public void InsertOrUpdate(Album album)
 {
     if (album.ID == default(int)) {
         // New entity
         context.Albums.Add(album);
     } else {
         // Existing entity
         context.Entry(album).State = EntityState.Modified;
     }
 }
 public ActionResult Create(Album album)
 {
     if (ModelState.IsValid) {
         albumRepository.InsertOrUpdate(album);
         albumRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }