public ActionResult Create(FormCollection collection) { try { var genre = new Genre { Description = collection.GetValue("description").AttemptedValue, Name = collection.GetValue("name").AttemptedValue }; if (!genreRepository.AddEntity(genre)) { throw new InvalidOperationException("Error during genre creation"); } return RedirectToAction("Search", "Genres"); } catch { ViewBag.Error = "Error during genre creation"; return RedirectToAction("Search", "Genres"); } }