public ActionResult Index(int?id, string errMessage = "",
                                  bool sectionOpen          = false, bool categoryOpen     = false, bool tagOpen     = false,
                                  bool sectionEditOpen      = false, bool categoryEditOpen = false, bool tagEditOpen = false, bool boardEditOpen = false, bool cardEditOpen = false)
        {
            BoardViewModel view = new BoardViewModel();
            string         user = User.Identity.GetUserId();

            if (db.Boards.Where(b => b.OwnerID == user).Count() > 0)
            {
                List <Board>     boards     = db.Boards.Where(b => b.OwnerID == user).ToList();
                List <MiniBoard> miniBoards = new List <MiniBoard>();
                foreach (var b in boards)
                {
                    MiniBoard m = new MiniBoard(b.ID, b.Title);
                    miniBoards.Add(m);
                }
                view.Boards = miniBoards;

                if (id == null)
                {
                    view.SelectedBoard = boards.FirstOrDefault();
                }
                else
                {
                    Board origBoard = db.Boards.Find(id);
                    if (origBoard == null)
                    {
                        return(HttpNotFound());
                    }
                    Board selectedBoard = boards.Where(b => b.ID == id).FirstOrDefault();
                    if (selectedBoard == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
                    }
                    view.SelectedBoard = selectedBoard;
                }

                SectionRow row = new SectionRow();
                view.SectionTable = row.getTable(view.SelectedBoard.Sections.ToList());
                foreach (var r in view.SectionTable)
                {
                    r.Row = r.Row.OrderBy(rr => rr.Order).ToList();
                }
                view.ActiveSections = row.getActiveSections(view.SelectedBoard.Sections.ToList(), view.SectionTable);
                List <Section> sections = view.SelectedBoard.Sections.OrderBy(s => s.ParentID).ThenBy(s => s.Order).ToList();
                view.SelectedBoard.Sections = sections;
                List <Card> cards = new List <Card>();
                foreach (var item in view.ActiveSections)
                {
                    cards.AddRange(item.Cards);
                    List <Card> orderCards = item.Cards.OrderBy(c => c.Order).ToList();
                    item.Cards = orderCards;
                }
                ViewBag.uncategorizedCards = cards.Count > 0 ? true : false;
            }

            ViewBag.sectionOpen      = sectionOpen;
            ViewBag.categoryOpen     = categoryOpen;
            ViewBag.tagOpen          = tagOpen;
            ViewBag.sectionEditOpen  = sectionEditOpen;
            ViewBag.categoryEditOpen = categoryEditOpen;
            ViewBag.tagEditOpen      = tagEditOpen;
            ViewBag.boardEditOpen    = boardEditOpen;
            ViewBag.cardEditOpen     = cardEditOpen;
            ViewBag.errorMessage     = errMessage;
            return(View(view));
        }