title: C# exclude duplicate code from two method returning expression
body: <p>I have two functions, returning expression translated to EF.:</p>
  
  <pre><code> public static Expression&lt;Func&lt;TripLanguage, TripViewModel&gt;&gt; ToSearchModel(ILookup&lt;int, TagViewModel&gt; tags)
      {            
          return tripLanguage =&gt; new TripViewModel()
          {
              From = tripLanguage.From,
              To = tripLanguage.To,
              Annotation = tripLanguage.Description.Truncate(Strings.TRUNCATE_ANOTATION),
              Level = tripLanguage.Trip.Level,
              BicycleType = tripLanguage.Trip.BicycleType,
              UrlId = tripLanguage.UrlId,
              Distance = tripLanguage.Trip.Distance,
              Tags = tags[tripLanguage.TripId], //This is only different and in function args of course
              MainImage = tripLanguage.Trip.Images.OrderBy(s =&gt; s.Date).Select(i =&gt; new ImageViewModel
              {
                  Filename = i.Filename,
                  Id = i.Id,
                  Title = i.Title
              }).Take(1)
          };
      }
  
      public static Expression&lt;Func&lt;TripLanguage, TripViewModel&gt;&gt; ToSearchModel()
      {
          return tripLanguage =&gt; new TripViewModel()
          {
              From = tripLanguage.From,
              To = tripLanguage.To,
              Annotation = tripLanguage.Description.Truncate(Strings.TRUNCATE_ANOTATION),
              Level = tripLanguage.Trip.Level,
              BicycleType = tripLanguage.Trip.BicycleType,
              UrlId = tripLanguage.UrlId,
              Distance = tripLanguage.Trip.Distance,                
              MainImage = tripLanguage.Trip.Images.OrderBy(s =&gt; s.Date).Select(i =&gt; new ImageViewModel
              {
                  Filename = i.Filename,
                  Id = i.Id,
                  Title = i.Title
              }).Take(1)
          };
      }
  </code></pre>
  
  <p>The only different is <code>Tags</code> collection. Is possible something like call method, without arguments and add Tags attribute which exclude duplicate code? Or Use some inheritance expression?</p>
  
  <p>Thank you for your time.</p>