title: deleting and creating new child collection in Nhibernate in same session
body: <p>I have a requirement to delete an existing collection inside a parent item and insert new collection entries. This should happen in same transaction.
  Kindly check the below hbm config. Please let me know why the delete is not happening with below code.</p>
  
  <pre><code>&lt;class name="Category" table="Category" schema="dbo" lazy="true"&gt;
  &lt;id name="ID" access="property" column="Category_ID" unsaved-value="0"&gt;
    &lt;generator class="native"&gt;
    &lt;/generator&gt;
  &lt;/id&gt;
  
  &lt;property name ="CategoryName" access="property" column="Category_Name" not-null="true"/&gt;
  &lt;bag name="Ratios" access="property"  table="Ratio" inverse="true" cascade="all"  lazy="true"&gt;
    &lt;key column="CategoryID" /&gt;
    &lt;one-to-many class="Category, Domain" /&gt;
  &lt;/bag&gt;
  </code></pre>
  
  <p>C# code:</p>
  
  <pre><code>if (ratios!= null &amp;&amp; ratios.Count &gt; 0)
                              {
                                  ratios= ratios.Where(a =&gt; a.ID == 0).ToList&lt;Ratio&gt;();
                                  cat.Ratios = ratios;
                                  if (cat.ID == 0)
                                  {
                                      _repository.Save(cat);
                                  }
                                  else
                                  {
                                      _repository.Update(cat);
                                  }
                              }
  </code></pre>
  
  <p>Please note that this is within a single Nhibernate session transaction.
  I am only passing the new collection using ratios= ratios.Where(a => a.ID == 0).ToList();
   So the collection now doesnt have already saved entities in the reference.</p>