private Option <ADSK.File> DownloadConfiguration(string configPath, int networkRetries, string synchronizerConfigurationPath, Option <MCADCommon.LogCommon.DisposableFileLogger> logger, List <string> errors)
        {
            ADSK.File[]        configurationFiles = connection.WebServiceManager.DocumentService.FindLatestFilesByPaths(new String[] { synchronizerConfigurationPath });
            Option <ADSK.File> configurationFile  = Option.None;

            if (configurationFiles.Count() > 0)
            {
                VaultCommunication.DownloadFilesWithChecksum(connection, new List <VaultEagleLib.Model.DataStructures.DownloadFile>()
                {
                    new VaultEagleLib.Model.DataStructures.DownloadFile(configurationFiles[0], configPath, false, false)
                }, logger, networkRetries);                                                                                                                                                                                                                            /*MCADCommon.VaultCommon.FileOperations.DownloadFile(connection, configurationFiles[0], path: configPath);*/
                if (VaultUtils.HandleNetworkErrors(() => !System.IO.File.Exists(Path.Combine(configPath, configurationFiles[0].Name)), networkRetries))
                {
                    logger.IfSomeDo(l => l.Error("Failed to download configuration file."));
                    errors.Add("Failed to download configuration file.");
                    //if (mailInfo.IsSome)
                    //{
                    //    MCADCommon.MailCommon.Mailer mailer = new MCADCommon.MailCommon.Mailer(mailInfo.Get());
                    //    mailer.Mail("Vault synchronizer failed", errors.StringJoin("\n\r"), new List<string>());
                    //}
                }
                configurationFile = configurationFiles[0].AsOption();
            }
            else
            {
                logger.IfSomeDo(l => l.Error("Could not find configuration file."));
                errors.Add("Could not find configuration file.");
                //if (mailInfo.IsSome)
                //{
                //    MCADCommon.MailCommon.Mailer mailer = new MCADCommon.MailCommon.Mailer(mailInfo.Get());
                //    mailer.Mail("Vault synchronizer failed", errors.StringJoin("\n\r"), new List<string>());
                //}
            }
            return(configurationFile);
        }
        private List <string> SynchronizeFileBatches(List <VaultEagleLib.Model.DataStructures.DownloadItem> fileFolders, VaultEagleLib.SynchronizationItem[] items, Option <MCADCommon.LogCommon.DisposableFileLogger> logger, int retries)
        {
            // foreach (VaultEagleLib.SynchronizationItem item in items)
            //   item.HandleLockedFiles(fileFolders, retries, logger);

            List <VaultEagleLib.Model.DataStructures.DownloadFolder> folders = fileFolders.OfType <VaultEagleLib.Model.DataStructures.DownloadFolder>().ToList();//Where(f => f.Item1 == null).ToList();

            foreach (VaultEagleLib.Model.DataStructures.DownloadFolder folder in folders)
            {
                if (!VaultEagle.VaultUtils.HandleNetworkErrors(() => Directory.Exists(folder.DownloadPath), retries))
                {
                    VaultEagle.VaultUtils.HandleNetworkErrors(() => Directory.CreateDirectory(folder.DownloadPath), retries);
                }
            }
            return(VaultCommunication.DownloadFilesWithChecksum(connection, fileFolders.OfType <VaultEagleLib.Model.DataStructures.DownloadFile>().ToList(), logger, retries));
        }