public void RemoveCollection(FilteredCollection <TItem> collection)
 {
     lock (collections)
     {
         collections.Remove(collection);
     }
 }
        public FilteredCollection <TItem> GetOrAddCollection(string queueName, int queueCapacity, Func <TItem, bool> elementFilter = null)
        {
            FilteredCollection <TItem> collection;

            collection = collections.FirstOrDefault(s => s.QueueName == queueName);
            if (collection == null)
            {
                collection = new FilteredCollection <TItem>(this, queueName, elementFilter ?? defaultFilter, queueCapacity);

                lock (collections)
                {
                    collections.Add(collection);
                }
            }

            collection.LastRead = DateTime.Now;
            return(collection);
        }