/// <summary>
        /// Create controller for "Done" block which is initially collapsed
        /// </summary>
        public static CollapsedBlockController CreateControllerForDoneBlock(Action <BlockController> blockGotFocusHandler,
                                                                            Action <CollapsedBlockController> expansionRequested)
        {
            var data = new BoxSearchController.CollapseData
            {
                DoneMode     = true,
                DoneSinceCri = DateUtil.ToYMD(DateTime.Today.AddDays(-14))
            };

            return(new CollapsedBlockController(typeof(BoxSearchController), blockGotFocusHandler, expansionRequested, "Done", data, false));
        }
        /// <summary>
        /// If the given block is not collapsible, return null. Else return the collapsed block controller for it,
        /// which can be used to replace it in the owning stack
        /// </summary>
        public static CollapsedBlockController CreateControllerFor(BaseBlockVM vm, Action <BlockController> blockGotFocusHandler,
                                                                   Action <CollapsedBlockController> expansionRequested)
        {
            if (vm is ExtBoxVM vm1)
            {
                var box = vm1.Persistent.Box;
                if (box.IsUnclass != 0)
                {
                    return(null);                    //cant collapse unclassified
                }
                var data = new ExtBoxController.CollapseData {
                    RowId = box.RowId
                };
                return(new CollapsedBlockController(typeof(ExtBoxController), blockGotFocusHandler, expansionRequested, box.Title, data: data, true));
            }
            if (vm is ExtPersonVM vm2)
            {
                var person = vm2.Persistent.Person;
                var data   = new ExtPersonController.CollapseData {
                    RowId = person.RowId
                };
                return(new CollapsedBlockController(typeof(ExtPersonController), blockGotFocusHandler, expansionRequested, person.Name, data: data, true));
            }
            if (vm is TodayVM vm3)
            {
                string title = vm3.IsToday ? "Today" : "Tomorrow";
                var    data  = new TodayController.CollapseData {
                    IsToday = vm3.IsToday
                };
                return(new CollapsedBlockController(typeof(TodayController), blockGotFocusHandler, expansionRequested, title, data, false));
            }
            if (vm is BoxSearchVM vm4)
            {
                var data = new BoxSearchController.CollapseData
                {
                    DoneMode          = vm4.DoneMode,
                    DoneSinceCri      = vm4.DoneSinceCri.Date,
                    IncludeDetailsCri = vm4.IncludeDetailsCri,
                    TermCri           = vm4.TermCri
                };
                return(new CollapsedBlockController(typeof(BoxSearchController), blockGotFocusHandler, expansionRequested, vm4.BlockTitle, data, !vm4.DoneMode));
            }
            if (vm is PersonSearchVM vm8)
            {
                var data = new PersonSearchController.CollapseData
                {
                    IncludeDetailsCri = vm8.IncludeDetailsCri,
                    TermCri           = vm8.TermCri,
                    CatIdCri          = vm8.CatIdCri
                };
                return(new CollapsedBlockController(typeof(PersonSearchController), blockGotFocusHandler, expansionRequested, vm8.BlockTitle, data, true));
            }
            if (vm is AgendaVM vm5)
            {
                return(new CollapsedBlockController(typeof(AgendaController), blockGotFocusHandler, expansionRequested, "Agenda", null, false));
            }
            if (vm is CalendarVM vm6)
            {
                return(new CollapsedBlockController(typeof(CalendarController), blockGotFocusHandler, expansionRequested, "Calendar", null, false));
            }
            if (vm is SubjectVM vm7)
            {
                return(new CollapsedBlockController(typeof(SubjectController), blockGotFocusHandler, expansionRequested, "Subjects", null, false));
            }

            return(null);
        }