title: Deleting null items from an ObservableCollection
body: <p>I'm having some trouble with the following code:</p>
  
  <pre><code>AllAgents.CollectionChanged += (sender, e) =&gt;
              {
                  if (e.Action != NotifyCollectionChangedAction.Remove) return;
  
                  foreach (var s in AllSnapshots)
                  {
                      foreach (var stat in s.Stats.Where(stat =&gt; stat.Model.Agent == null))
                          s.Stats.Remove(stat);
                  }
              };
  </code></pre>
  
  <p>This of course, throws a "Collection was modified; enumeration operation may not execute." exception which makes total sense to me. The question is, what is the best way to accomplish removing all items where the Model.Agent property is null from my ObservableCollection? I'm open to other solutions as well, essentially, when an Agent is removed from the AllAgents collection, I need to remove any entries from my AllSnapshots.Stats collection that referred to that Agent.</p>