title: How to map IEnumerable<SelectListItem> to IList<> for ListBox
body: <p>I have two classes. Class1 and Class2. </p>
  
  <pre><code>public class Class1{
     ...
     public virtual IList&lt;Class2&gt; Class2s{get;set;}
     ...
  }
  public class Class2{
     ...
     public virtual IList&lt;Class1&gt; Class1s{get;set;}
     ...
  }
  </code></pre>
  
  <p>The view contains</p>
  
  <pre><code>&lt;%=Html.ListBox("Class2s",
                          ViewData.Model.Class2s.Select(
                                                      x =&gt; new SelectListItem {
                                                          Text = x.Name,
                                                          Value = x.Id.ToString(),
                                                          Selected =  ViewData.Model.Class1.Class2s.Any(y =&gt; y.Id == x.Id)
                                                      })
  </code></pre>
  
  <p>They have many to many mapping. I have a ListBox in Class1 view which displays Class2. How to map the output of the ListBox back to IList Class2s property of Class1? I am able to display the values in the ListBox but unable to map back the SelectListItem to IList.</p>