Inheritance: ExplorerItemBaseVM
        public CollectionExpItemVM(DatabaseExpItemVM parentDatabaseExp, CollectionModel model, MainVM main, CollectionViewModel sourceView = null, CollectionExpItemVM viewSourceCollection = null) : base(main)
        {
            _parentDbExpItem = parentDatabaseExp;
            _model = model;
            if (sourceView != null)
            {
                this.View = sourceView;
                IsView = true;
                ViewSourceCollection = viewSourceCollection;
            }
            else
            {
                this.View = new CollectionViewModel();
                IsView = false;
            }
            this.ContextMenuItems.Add(new MenuItemVM()
            {
                Caption = "Refresh",
                Command = new LambdaCommand((o) => _wrkspc?.Refresh())
            });
           

            if (sourceView == null)
            {
                var savedCollection = Config.Instance.GetCollection(model.AccountEndpoint, model.DatabaseName, model.Name);
                if (savedCollection != null)
                {
                    this.IsExpanded = savedCollection.IsExpanded;
                    if (savedCollection.Views != null)
                    {
                        foreach (var view in savedCollection.Views)
                        {
                            this.Children.Add(new CollectionExpItemVM(parentDatabaseExp, model, main, view, this));
                        }
                    }
                }
                this.ContextMenuItems.Add(new MenuItemVM()
                {
                    Caption = "Delete collection",
                    Command = new LambdaCommand(async (o) =>
                    {
                        MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
                        if (messageBoxResult == MessageBoxResult.Yes)
                        {
                            await this._model.DeleteCollectionFromDatabase();
                            parentDatabaseExp.Children.Remove(this);
                        }
                    })
                });
            }
            else
            {
                this.ContextMenuItems.Add(new MenuItemVM()
                {
                    Caption = "Delete view",
                    Command = new LambdaCommand((o) =>
                    {
                        MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
                        if (messageBoxResult == MessageBoxResult.Yes)
                        {
                            this.ViewSourceCollection.Children.Remove(this);
                            this.ViewSourceCollection.IsSelected = true;
                            Config.Instance.RemoveCollectionView(_model.AccountEndpoint, _model.DatabaseName, this.View);
                        }
                    })
                });
            }
        }
        public CollectionExpItemVM(DatabaseExpItemVM parentDatabaseExp, CollectionModel model, MainVM main, CollectionViewModel sourceView = null, CollectionExpItemVM viewSourceCollection = null) : base(main)
        {
            _parentDbExpItem = parentDatabaseExp;
            _model           = model;
            if (sourceView != null)
            {
                this.View            = sourceView;
                IsView               = true;
                ViewSourceCollection = viewSourceCollection;
            }
            else
            {
                this.View = new CollectionViewModel();
                IsView    = false;
            }
            this.ContextMenuItems.Add(new MenuItemVM()
            {
                Caption = "Refresh",
                Command = new LambdaCommand((o) => _wrkspc?.Refresh())
            });


            if (sourceView == null)
            {
                var savedCollection = Config.Instance.GetCollection(model.AccountEndpoint, model.DatabaseName, model.Name);
                if (savedCollection != null)
                {
                    this.IsExpanded = savedCollection.IsExpanded;
                    if (savedCollection.Views != null)
                    {
                        foreach (var view in savedCollection.Views)
                        {
                            this.Children.Add(new CollectionExpItemVM(parentDatabaseExp, model, main, view, this));
                        }
                    }
                }
                this.ContextMenuItems.Add(new MenuItemVM()
                {
                    Caption = "Delete collection",
                    Command = new LambdaCommand(async(o) =>
                    {
                        MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
                        if (messageBoxResult == MessageBoxResult.Yes)
                        {
                            await this._model.DeleteCollectionFromDatabase();
                            parentDatabaseExp.Children.Remove(this);
                        }
                    })
                });
            }
            else
            {
                this.ContextMenuItems.Add(new MenuItemVM()
                {
                    Caption = "Delete view",
                    Command = new LambdaCommand((o) =>
                    {
                        MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);
                        if (messageBoxResult == MessageBoxResult.Yes)
                        {
                            this.ViewSourceCollection.Children.Remove(this);
                            this.ViewSourceCollection.IsSelected = true;
                            Config.Instance.RemoveCollectionView(_model.AccountEndpoint, _model.DatabaseName, this.View);
                        }
                    })
                });
            }
        }