private IBackupIndex GetUnstoredFiles(IBackupIndex existingIndex, IBackupIndex previousIndex)
        {
            if (previousIndex == null)
            {
                return(existingIndex);
            }

            var diffIndex             = new BackupIndex();
            var allPreviousFileHashes = previousIndex.GetAllNodeHashes();

            foreach (var existingBackupSet in existingIndex.BackupSets)
            {
                var diffBackupSet = diffIndex.AddBackupSet(existingBackupSet.BasePath, existingBackupSet.Root.Name);
                DiffBackupSets(existingBackupSet.Root, diffBackupSet.Root, allPreviousFileHashes);
            }

            return(diffIndex);
        }
        private IBackupIndex GetNewBackupIndex()
        {
            var newBackupIndex      = new BackupIndex();
            var directoriesToBackup = Catalog.GetDirectories();

            foreach (var directory in directoriesToBackup)
            {
                var backupDirectory = BackupIOFactory.GetBackupDirectory(directory);
                var newBranch       = new Branch(backupDirectory.Name);
                var root            = GetTree(backupDirectory, newBranch);
                var newBackupSet    = new BackupSet(backupDirectory.FullName, backupDirectory.Name)
                {
                    Root = root
                };
                newBackupIndex.BackupSets.Add(newBackupSet);
            }

            return(newBackupIndex);
        }