public void CloseDocument(IDocument document)
        {
            if (!OpenDocuments.Contains(document))
            {
                throw new ArgumentException("CloseDocument called with non-existant document");
            }

            if (document.IsScript && ActiveDocument == document)
            {
                _sectionBrowserViewModel.ClearDown();
                _blockGroupBrowserViewModel.ClearDown();
                _blockOutputPreviewViewModel.ClearDown();
            }

            _openDocuments.Remove(document);
            if (_activeDocument == document)
            {
                _activeDocument = null;
            }


            // TODO: Replace _activeScriptViewModel and _activeThemeViewModel with a better solution.

            if (document.IsScript && _activeScriptViewModel == (IItemFilterScriptViewModel)document)
            {
                _activeScriptViewModel = null;
            }

            if (document.IsTheme && _activeThemeViewModel == (IThemeEditorViewModel)document)
            {
                _activeThemeViewModel = null;
            }
        }
        public void SwitchActiveDocument(IDocument document)
        {
            if (!OpenDocuments.Contains(document))
            {
                throw new ArgumentException("SwitchActiveDocument called with non-existant document");
            }

            ActiveDocument = document;
        }