public void AddHashRangeToStore(HashSet <byte[]> incomingHashes, string range, OperationProgress progress)
        {
            if (this.IsInBatch)
            {
                this.AddHashRangeToTempStore(incomingHashes, range);
                return;
            }

            string file = Path.Combine(this.StorePath, $"{range}.db");

            bool             hasChanges = false;
            HashSet <byte[]> hashesToProcess;

            if (File.Exists(file))
            {
                HashSet <byte[]> originalHashes = new HashSet <byte[]>(ByteArrayComparer.Comparer);
                this.LoadHashesFromStoreFile(file, originalHashes, progress);
                hasChanges      = this.MergeHashSets(originalHashes, incomingHashes, progress);
                hashesToProcess = originalHashes;
            }
            else
            {
                progress?.IncrementHashesAdded(incomingHashes.Count);
                hashesToProcess = incomingHashes;
                hasChanges      = true;
            }

            if (hasChanges)
            {
                this.WriteStoreFile(file, false, hashesToProcess);
            }
        }
        private bool MergeHashSets(HashSet <byte[]> existingHashes, HashSet <byte[]> newHashes, OperationProgress progress)
        {
            bool write = false;

            foreach (byte[] hash in newHashes)
            {
                if (existingHashes.Add(hash))
                {
                    progress?.IncrementHashesAdded();
                    write = true;
                }
                else
                {
                    progress?.IncrementHashesDiscarded();
                }
            }

            return(write);
        }