private IList <DuplicateEntry> GetCollectionFor(DuplicateEntry newEntry)
        {
            var hashCode        = newEntry.GetHashCode();
            var entryCollection = _bucket[hashCode] as IList <DuplicateEntry>;

            if (entryCollection == null)
            {
                entryCollection   = new List <DuplicateEntry>();
                _bucket[hashCode] = entryCollection;
            }
            return(entryCollection);
        }
        /// <summary>
        /// Adds a new file to this duplicate container. The file is directly checked if it is a duplicate or not.
        /// </summary>
        /// <param name="fileSystemInfo"></param>
        /// <returns>True if the entry is a duplicate.</returns>
        public bool Add(FileInfo fileSystemInfo)
        {
            var newEntry = new DuplicateEntry(this, fileSystemInfo);

            var collection = GetCollectionFor(newEntry);

            // Check for equal files.
            foreach (var entry in collection)
            {
                if (entry.Equals(newEntry))
                {
                    entry.Merge(newEntry);
                    return(true);
                }
            }
            // No equal file, so add it as a new one.
            collection.Add(newEntry);
            return(false);
        }