public void PruneByRank(long maxRankAllowed) { IEnumerable <T> removedItems = _store .OrderBy(kvp => kvp.Value) .Select(kvp => kvp.Key) .Take((int)Math.Max(0, this.DistinctRepresentedEvents.LongCount() - maxRankAllowed)); foreach (var item in removedItems) { _store.RemoveAllCopies(item); } _containsUnrepresentedNoiseEvents = true; }