title: Exception with LINQ OrderBy
body: <p>My linq query is as follows:</p>
  
  <pre><code>var agreementsMatching = _ctx.LeasingAgreements
      .Where(x =&gt; x.Dealer.Id == dealer.dealerId)
      .ToList();
  var ag = agreementsMatching
      .OrderBy(o =&gt; o.Model.Specification)
      .OrderBy(o =&gt; o.Model.ModelName)
      .OrderBy(o =&gt; o.Model.ModelBrand)
      .OrderBy(c =&gt; c.LeasingAgreementClicks)
      .GroupBy(sg =&gt; sg.Model.Specification)
      .Select(sg =&gt; new { GroupId = sg.Key, Agreements = sg });
  </code></pre>
  
  <p>The reason I think it might not be the best query is also that it gives me an exception:</p>
  
  <blockquote>
    <p>At least one object must implement IComparable.</p>
  </blockquote>
  
  <p>I do know that it occurs because one or more objects are not implementing the <code>IComparable</code> interface. I'm just not sure on how to actually handle it.</p>
  
  <hr>
  
  <p>Edit: It turned out that I didn't need all those <code>OrderBy</code> calls. I could simply do this:</p>
  
  <pre><code>var agreementsMatching = _ctx.LeasingAgreements
      .Where(x =&gt; x.Dealer.Id == dealer.dealerId)
      .ToList();
  var ag = agreementsMatching
      .GroupBy(sg =&gt; sg.Model.Specification)
      .Select(sg =&gt; new { GroupId = sg.Key, Agreements = sg });
  </code></pre>
  
  <p>Though the problem is solved now, I still would like to learn how to avoid the aforementioned error :)</p>