private void LoadAdminLevels()
        {
            SettingsRepository settings = new SettingsRepository();
            DemoRepository repo = new DemoRepository();
            var levels = settings.GetAllAdminLevels();
            var t = repo.GetAdminLevelTree(levels.OrderByDescending(l => l.LevelNumber).ToArray()[1].Id, 0, true, true, levelType);
            treeAvailable.CanExpandGetter = m => ((AdminLevel)m).Children.Count > 0;
            treeAvailable.ChildrenGetter = delegate(object m)
            {
                return ((AdminLevel)m).Children;
            };
            treeAvailable.SetObjects(t);

            foreach (var l in t)
            {
                treeAvailable.Expand(l);
                foreach (var l2 in l.Children)
                    treeAvailable.Expand(l2);
            }
        }
        public void LoadTree()
        {
            treeListView1.ClearObjects();
            DemoRepository r = new DemoRepository();
            var t = r.GetAdminLevelTree();
            treeListView1.CanExpandGetter = model => ((AdminLevel)model).
                                                          Children.Count > 0;
            treeListView1.ChildrenGetter = delegate(object model)
            {
                return ((AdminLevel)model).
                        Children;
            };
            treeListView1.SetObjects(t);

            if (preloadedLevel != null)
                LoadDashboard(preloadedLevel);
            else if (t.Count > 0)
                LoadDashboard(t.FirstOrDefault());

            var root = t.FirstOrDefault();
            treeListView1.Expand(root);
        }