/// <summary>
 /// Updates the snapshot that is used to generate an Enumerator
 /// </summary>
 void UpdateSnapshot()
 {
     if (NewSnapshotRequired)
     {
         SnapshotLock.TryEnterWriteLock(Timeout.Infinite);
         if (NewSnapshotRequired)
         {
             BaseSnapshot        = new ImmutableCollection <T>(BaseCollection);
             NewSnapshotRequired = false;
         }
         SnapshotLock.ExitWriteLock();
     }
 }
        /// <summary>
        /// Constructor that takes an eumerable
        /// </summary>
        protected ConcurrentCollectionBase(IEnumerable <T> Items)
        {
            Subscribers = new Dictionary <int, IObserver <NotifyCollectionChangedEventArgs> >();

            BaseCollection = new ObservableCollection <T>(Items);
            BaseSnapshot   = new ImmutableCollection <T>(Items);

            // subscribers must be initialized befor calling this as it may
            // subscribe immediately
            viewModel = new ConcurrentCollectionViewModel <T>(this);

            // Handle when the base collection changes. Event will be passed through
            // the IObservable.OnNext method.
            BaseCollection.CollectionChanged += HandleBaseCollectionChanged;

            // Bubble up the notify collection changed event from the view model
            viewModel.CollectionChanged += (sender, e) => CollectionChanged?.Invoke(sender, e);
        }