public ActionResult Edit(ItemBindingModel model)
        {
            if (ModelState.IsValid)
            {
                var item = model.ToItem(catRepo);

                repo.Update(item);
                return(RedirectToAction("Index", new { channelId = model.ChannelID }));
            }
            return(View(model));
        }
        public ActionResult Create(ItemBindingModel model)
        {
            if (ModelState.IsValid)
            {
                var item = model.ToItem(catRepo);
                item.PublicationDate = DateTime.Now;
                repo.Create(item);

                return(RedirectToAction("Index", new { channelId = model.ChannelID }));
            }

            string messages = string.Join("; ", ModelState.Values
                                          .SelectMany(x => x.Errors)
                                          .Select(x => x.ErrorMessage));

            return(View(model));
        }