private void RemoveItem(FolderViewModel folder)
        {
            folder.OnOpened  -= OnItemOpened;
            folder.OnDeleted -= OnItemDeleted;

            SubDirectories.Remove(folder);
            AllItems.Remove(folder);
        }
        private void setUpBackgroundWorker()
        {
            bgWorker_loadSub = new BackgroundTaskManager <DispatcherNotifiedObservableCollection <DirectoryTreeItemViewModel> >(
                () =>
            {
                IsLoading = true;
                return(getDirectories());
            },
                (result) =>
            {
                List <DirectoryTreeItemViewModel> delList = new List <DirectoryTreeItemViewModel>(SubDirectories.ToArray());
                List <DirectoryTreeItemViewModel> addList = new List <DirectoryTreeItemViewModel>();

                foreach (DirectoryTreeItemViewModel model in result)
                {
                    if (delList.Contains(model))
                    {
                        delList.Remove(model);
                    }
                    else
                    {
                        addList.Add(model);
                    }
                }

                foreach (DirectoryTreeItemViewModel model in delList)
                {
                    SubDirectories.Remove(model);
                }

                foreach (DirectoryTreeItemViewModel model in addList)
                {
                    SubDirectories.Add(model);
                }

                HasSubDirectories = SubDirectories.Count > 0;


                IsLoading = false;
            });
        }