title: Filtering or removing from a list(Of T)
body: <p>I have a method Which takes a list of objects.<br>
  Before persisting the object I have to remove some of them on some given condition  </p>
  
  <p>for eg(not the ideal!):  </p>
  
  <blockquote>
    <p>A Company can have an Id and a list of Branches and a IsDeleted flag.<br>
    A Branch can have an Id and a list of Managers and a IsDeleted flag<br>
    A Manager can have an Id and a IsDeleted flag<br>
    Company -->Branches-->Managers  </p>
  </blockquote>
  
  <p>Whats the easy or the best way of filtering to ommit the combination of Id = 0 and IsDeleted = True  so I can iterate that and do specifics -- see the function below</p>
  
  <ul>
  <li>Thats if the company is marked as <code>Id = 0 and IsDeleted</code> then I want to ommit that altogether  </li>
  <li>But If Only Branch Is marked as <code>Id=0 and Isdeleted</code> then the Company Should be there without a Branch  </li>
  <li>If Only the Manager is matrked as <code>Id=0 and Isdeleted</code> then the Company and Branch should be there </li>
  </ul>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <pre><code>Private Function(comp as List(Of Company)) as Boolean
      'filter comp here and pass it to for loop??
      Dim filteredList as ...
      For each c as Company in filteredList 
      'do company specifis here
          For each b as Branch in c.Branches
          'do branch specific here
              For Each m as Manager in b.Managers
              'do manager specific here
              Next
          Next
      Save(c) ' saves child objects as well    
      Next
  End Function
  </code></pre>