/// <summary>
        /// All disk storage for this application is pointed to this directory.
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        protected string GetStoragePath(DiskServiceSettings settings)
        {
            var storage = this.GlobalSettings.GetDefaultContentStorage();

            // We can have an app_setting configuration
            // to route a whole application to a specific sql server
            string diskTarget;

            if (this.Deployment.installedApplicationSettings.configuration["disktarget"] != null)
            {
                diskTarget = Convert.ToString(this.Deployment.installedApplicationSettings.configuration["disktarget"]);
                this.Logger.LogInfo(true, "Custom disk target: " + diskTarget);

                if (!Directory.Exists(diskTarget))
                {
                    throw new Exception("Invalid custom disk target: " + diskTarget);
                }
            }
            else
            {
                // Generate a unique "virtual disk" (directory) for this application
                diskTarget = UtilsSystem.EnsureDirectoryExists(UtilsSystem.CombinePaths(
                                                                   storage.path,
                                                                   "store_" + this.Deployment.installedApplicationSettings.GetId()));
            }

            return(diskTarget);
        }
        public override void _sync(object input)
        {
            DiskService other        = (DiskService)input;
            var         diskSettings = this.DeployerSettings.castTo <DiskServiceSettings>();
            var         storage      = this.GlobalSettings.GetDefaultContentStorage();

            // Generate a unique virtual disk for this application
            DiskServiceSettings otherSettings = other.DeployerSettings.castTo <DiskServiceSettings>();

            foreach (var mount in diskSettings.mounts)
            {
                string           pathOri  = UtilsSystem.EnsureDirectoryExists(other.Deployment.GetRuntimeSettingsToDeploy()["services." + otherSettings.id + ".mount.files.path"]);
                string           pathDest = UtilsSystem.EnsureDirectoryExists(this.Deployment.GetRuntimeSettingsToDeploy()["services." + diskSettings.id + ".mount.files.path"]);
                FileSyncProvider ori      = new FileSyncProvider(pathOri);
                FileSyncProvider dest     = new FileSyncProvider(pathDest);

                SyncOrchestrator agent = new SyncOrchestrator();
                agent.LocalProvider  = ori;
                agent.RemoteProvider = dest;
                agent.Direction      = SyncDirectionOrder.Upload;

                SyncOperationStatistics syncStats = agent.Synchronize();
                this.Logger.LogInfo(
                    true,
                    "Synchronization stats \n\n local provider {0} to remote {1}\n upload changes applied {2}\n {3} upload changes failed",
                    pathOri,
                    pathDest,
                    syncStats.UploadChangesApplied,
                    syncStats.UploadChangesFailed);
                ori.Dispose();
                dest.Dispose();
            }
        }