title: Using LINQ to group by multiple properties and sum
body: <p>I have a collection of items, here it is:</p>
  
  <pre><code>AgencyID VendorID StateID Amount Fee
  1        1        1       20.00  5.00
  1        1        1       10.00  2.00
  1        1        1       30.00  8.00    
  2        2        1       20.00  5.00
  2        2        1       5.00   5.00
  1        1        2       20.00  5.00
  2        2        2       20.00  5.00
  2        2        2       40.00  9.00
  1        2        2       35.00  6.00
  1        2        2       12.00  3.00
  </code></pre>
  
  <p>I'd like these items to be grouped based on the AgencyID, VendorID, and StateID, and the Total calculated from Amount and Fee (Amount + Fee)</p>
  
  <p>So using the data above, I'd like to have these results:</p>
  
  <pre><code>AgencyID VendorID StateID Total
  1        1        1       75.00    
  2        2        1       35.00
  1        1        2       25.00
  2        2        2       74.00
  1        2        2       56.00
  </code></pre>
  
  <p>Here's all I have right now, which just gets every row in the database:</p>
  
  <pre><code>var agencyContracts = _agencyContractsRepository.AgencyContracts.
      Select(ac =&gt; new AgencyContractViewModel
      {
          AgencyContractId = ac.AgencyContractID,
          AgencyId = ac.AgencyID,
          VendorId = ac.VendorID,
          RegionId = ac.RegionID,
          Amount = ac.Amount,
          Fee = ac.Fee
      });
  </code></pre>
  
  <p>Does anyone know how I can filter and group this with LINQ?</p>