public NewOrOpenSessionTemplateCollectionViewModel(IViewModelServiceProvider serviceProvider, IModalDialog dialog)
            : base(serviceProvider)
        {
            this.dialog = dialog;
            rootGroup   = new TemplateDescriptionGroupViewModel(serviceProvider, "New project");

            // Add a default General group
            var defaultGroup = new TemplateDescriptionGroupViewModel(rootGroup, "General");

            foreach (TemplateDescription template in TemplateManager.FindTemplates(TemplateScope.Session))
            {
                var viewModel = new PackageTemplateViewModel(serviceProvider, template);
                var group     = ProcessGroup(rootGroup, template.Group) ?? defaultGroup;
                group.Templates.Add(viewModel);
            }

            recentGroup = new TemplateDescriptionGroupViewModel(serviceProvider, "Recent projects");
            foreach (var file in EditorViewModel.Instance.RecentFiles)
            {
                var viewModel = new ExistingProjectViewModel(ServiceProvider, file.FilePath, RemoveExistingProjects);
                recentGroup.Templates.Add(viewModel);
            }

            Location = InternalSettings.TemplatesWindowDialogLastNewSessionTemplateDirectory.GetValue();
            if (string.IsNullOrWhiteSpace(Location))
            {
                Location = UPath.Combine <UDirectory>(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Stride Projects");
            }

            BrowseForExistingProjectCommand = new AnonymousTaskCommand(serviceProvider, BrowseForExistingProject);
            SelectedGroup = recentGroup.Templates.Count == 0 ? rootGroup : recentGroup;
        }
        private async Task BrowseForExistingProject()
        {
            var filePath = await EditorDialogHelper.BrowseForExistingProject(ServiceProvider);

            if (filePath != null)
            {
                SelectedTemplate = new ExistingProjectViewModel(ServiceProvider, filePath, RemoveExistingProjects);
                dialog?.RequestClose(DialogResult.Ok);
            }
        }
        private void RemoveExistingProjects(ExistingProjectViewModel item)
        {
            if (item == null)
            {
                return;
            }

            EditorViewModel.Instance.RemoveRecentFile(item.Path);
            SelectedGroup.Templates.Remove(item);
            UpdateTemplateList();
        }