internal static void SetIMDIMetadataToArchive(IIMDIArchivable element, ArchivingDlgViewModel model)
        {
            var project = element as Project;

            if (project != null)
            {
                AddIMDIProjectData(project, model);

                foreach (var session in project.GetAllSessions())
                {
                    AddIMDISession(session, model);
                }
            }
            else
            {
                AddIMDISession((Session)element, model);
            }
        }
        internal static Project Project = null;         // Set for testing

        /// ------------------------------------------------------------------------------------
        internal static void ArchiveUsingIMDI(IIMDIArchivable element)
        {
            var destFolder = Program.CurrentProject.IMDIOutputDirectory;

            // Move IMDI export folder to be under the mydocs/saymore
            if (string.IsNullOrEmpty(destFolder))
            {
                destFolder = Path.Combine(NewProjectDlgViewModel.ParentFolderPathForNewProject, "IMDI Packages");
            }

            // SP-813: If project was moved, the stored IMDI path may not be valid, or not accessible
            if (!CheckForAccessiblePath(destFolder))
            {
                destFolder = Path.Combine(NewProjectDlgViewModel.ParentFolderPathForNewProject, "IMDI Packages");
            }

            // now that we added a separate title field for projects, make sure it's not empty
            var title = string.IsNullOrEmpty(element.Title) ? element.Id : element.Title;

            var model = new IMDIArchivingDlgViewModel(Application.ProductName, title, element.Id,
                                                      element.ArchiveInfoDetails, element is Project, element.SetFilesToArchive, destFolder)
            {
                HandleNonFatalError = (exception, s) => ErrorReport.NotifyUserOfProblem(exception, s)
            };

            element.InitializeModel(model);

            using (var dlg = new IMDIArchivingDlg(model, ApplicationContainer.kSayMoreLocalizationId,
                                                  Program.DialogFont, Settings.Default.ArchivingDialog))
            {
                dlg.ShowDialog(Program.ProjectWindow);
                Settings.Default.ArchivingDialog = dlg.FormSettings;

                // remember choice for next time
                if (model.OutputFolder != Program.CurrentProject.IMDIOutputDirectory)
                {
                    Program.CurrentProject.IMDIOutputDirectory = model.OutputFolder;
                    Program.CurrentProject.Save();
                }
            }
        }