title: Handling Nulls in a model passed over into a controller
body: <p>I am trying to fix these linq statements so that they wont error if the model is null. </p>
  
  <p>For example:
  <code>model.FilterSet.Dispositions</code> may be null. While <code>model.FilterSet.GenderFilters</code> may not. </p>
  
  <p>My current linq statement gives error if there is a null so I tried to add <code>.Where(item =&gt; item != null)</code> in the DispositionFilters linq, but it gives me an error saying that this will always be true.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var filters = new RespondentCSVFilters
              {
                  CSVFilters = new CSVFilters 
                  { 
                      DispositionFilters = model.FilterSet.Dispositions.Where(item=&gt;item != null).ToList().ConvertAll(item =&gt; (int)((RespondentStatus)Enum.Parse(typeof(RespondentStatus), item.ToString()))),
                      EthnicitiesFilters = model.FilterSet.Ethnicities.ConvertAll(item =&gt; (int)((Ethnicity)Enum.Parse(typeof(Ethnicity), item.ToString()))),
                      GenderFilters = model.FilterSet.Genders.ConvertAll(item =&gt; (int)((Gender)Enum.Parse(typeof(Gender), item.ToString()))),
                      SourcesFilters = model.FilterSet.Sources.ConvertAll(item =&gt; (int)((RespondentSource)Enum.Parse(typeof(RespondentSource), item.ToString()))),
                  }
              };
  </code></pre>
  
  <p>I am not sure how to make the changes in order to handle nulls.</p>