public ActionResult Create(Forum theForum)
 {
     try
     {
         UpdateModel(theForum);
         db.Forums.Add(theForum);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View(theForum);
     }
 }
 public ActionResult Edit(Forum theForum)
 {
     Forum updatedForum = 
         db.Forums.SingleOrDefault(f => f.ForumId == theForum.ForumId);
     try
     {
         UpdateModel(updatedForum);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View(theForum);
     }
 }
 private List<Thread> GetNonStickyThreads(Forum forum)
 {
     forum.Threads = forum.Threads.OrderByDescending
                                  (t => t.Posts[t.Posts.Count - 1].PostDate)
                                  .ToList();
     var nonStickyThreads = from t in forum.Threads
                            where t.IsSticky == false
                            select t;
     List<Thread> threads = nonStickyThreads.Skip((pageNumber - 1) * Preferences.PAGE_SIZE)
                                         .Take(Preferences.PAGE_SIZE).ToList();
     return threads;
 }