title: Filter Dictionary When Items Don't Exist In Another Dictionary
body: <p>I have the following scenario - a list of parent items that are the key in a dictionary, and their children, which are the values.</p>
  
  <p>So my dictionary looks like this - <code>Dictionary&lt;ParentModel,List&lt;ChildModel&gt;&gt;</code></p>
  
  <p>I have a second dictionary that contains looks like this - Dictionary - where the key is an integer value that actually maps to a property in my <code>ChildModel</code> class, and the value is set to true or false based on whether or not I want to use the key in my filter.</p>
  
  <p>So what I'm trying to do is get a list of ParentModels in my dictionary that don't have any children whose ids match the keys in the second dictionary when they key's value is set to true.</p>
  
  <p>Pseudo code -</p>
  
  <pre><code>Dictionary&lt;ParentModel, List&lt;ChildModel&gt;&gt; parentDictionary;
  Dictionary&lt;int, bool&gt; selectedChildIds;
  
  parentDictionary.Where(x =&gt; !x.Value.Exists(y =&gt; selectedChildIds.Where(z =&gt; z.Value).Any(d =&gt; d.Key == y.SomeProperty)))
  </code></pre>
  
  <p>Obviously the code is wrong, so I'm looking for assistance with how to achieve my objective using Linq.</p>
  
  <p>Thanks in advance for the help!</p>