public void Create(Feed feed)
        {
            // HACK: should be using database-side value generation?
            feed.Created = DateTime.UtcNow;

            using (var trans = Session.BeginTransaction())
            {
                Session.Save(feed);
                trans.Commit();
            }
        }
        public void Edit(long id, Feed feed)
        {
            using (var trans = Session.BeginTransaction())
            {
                var dbFeed = Session.Get<Feed>(id);

                dbFeed.Name = feed.Name;
                dbFeed.Url = feed.Url;

                Session.Update(dbFeed);
                trans.Commit();
            }
        }
        public ActionResult Edit(long id, Feed feed)
        {
            ValidateFeed(feed);

            if (!ModelState.IsValid)
            {
                return View();
            }

            Feeds.Edit(id, feed);
            return RedirectToAction("Index");
        }
        void ValidateFeed(Feed feed)
        {
            if (string.IsNullOrEmpty(feed.Name))
            {
                ModelState.AddModelError("Name", "Name is required.", "");
            }

            if (!MvcHelpers.IsValidUri(feed.Url))
            {
                ModelState.AddModelError("Url", "Url is not valid.", "");
            }
        }