protected virtual IEnumerable <InstanceBackup> GetBackups()
        {
            var root = this.SafeCall(this.GetBackupsFolder);

            if (string.IsNullOrEmpty(root) || !FileSystem.FileSystem.Local.Directory.Exists(root))
            {
                yield break;
            }

            foreach (var child in FileSystem.FileSystem.Local.Directory.GetDirectories(root))
            {
                var childInfo = new DirectoryInfo(child);
                var date      = string.Format("\"{2}\", {0}, {1:hh:mm:ss tt}", childInfo.CreationTime.ToString("yyyy-MM-dd"),
                                              childInfo.CreationTime, childInfo.Name);

                if (string.IsNullOrEmpty(date))
                {
                    continue;
                }

                var backup = new InstanceBackup(date, child);
                if (!FileSystem.FileSystem.Local.Directory.Exists(backup.DatabasesFolderPath) && !FileSystem.FileSystem.Local.Directory.Exists(backup.MongoDatabasesFolderPath) && !FileSystem.FileSystem.Local.File.Exists(backup.WebRootFilePath) &&
                    !FileSystem.FileSystem.Local.File.Exists(backup.WebRootNoClientFilePath))
                {
                    continue;
                }

                yield return(backup);
            }
        }
    public RestoreArgs([NotNull] Instance instance, InstanceBackup backup = null)
    {
      Assert.ArgumentNotNull(instance, "instance");

      // if(backup == null)
      // {
      // IEnumerable<InstanceBackup> bs = instance.GetBackups();
      // Assert.IsNotNull(bs, "There isn't any available backup", false);
      // backup = bs.OrderBy(b => b.Date).FirstOrDefault();
      // Assert.IsNotNull(backup, "There isn't any available backup", false);
      // }
      this.Backup = backup;
      this.Instance = instance;
      this.WebRootPath = instance.WebRootPath;
      this.DataFolder = instance.DataFolderPath;
      this.instanceName = instance.Name;
    }
        protected virtual IEnumerable<InstanceBackup> GetBackups()
        {
            var root = this.SafeCall(this.GetBackupsFolder);
              if (string.IsNullOrEmpty(root) || !FileSystem.FileSystem.Local.Directory.Exists(root))
              {
            yield break;
              }

              foreach (var child in FileSystem.FileSystem.Local.Directory.GetDirectories(root))
              {
            var childInfo = new DirectoryInfo(child);
            var date = string.Format("\"{2}\", {0}, {1:hh:mm:ss tt}", childInfo.CreationTime.ToString("yyyy-MM-dd"),
              childInfo.CreationTime, childInfo.Name);

            if (string.IsNullOrEmpty(date))
            {
              continue;
            }

            var backup = new InstanceBackup(date, child);
            if (!FileSystem.FileSystem.Local.Directory.Exists(backup.DatabasesFolderPath) && !FileSystem.FileSystem.Local.Directory.Exists(backup.MongoDatabasesFolderPath) && !FileSystem.FileSystem.Local.File.Exists(backup.WebRootFilePath) &&
            !FileSystem.FileSystem.Local.File.Exists(backup.WebRootNoClientFilePath))
            {
              continue;
            }

            yield return backup;
              }
        }