title: How to return IEnumerable<T> as null
body: <p>I am having the below <code>ActivitiesDB.cs</code> which is a DBEntity class.</p>
  <pre><code>public class ActivitiesDB
  {
  public IEnumerable&lt;Activity&gt; Activities { get; set; }
  }
  
  public class Activity
  {
  public Guid ActivityId { get ;set; }
  public DateTime ActivityDateTime { get; set; }
  public DateTime UpdatedDateTime { get; set; }
  public IEnumerable&lt;MetaData&gt; MetaData { get; set; }
  }
  
  public class MetaData
  {
  public string Name { get; set; }
  public string Value { get; set; }
  }
  </code></pre>
  <p>sample data in DB(I am using CosmosDb in backend):</p>
  <pre><code>&quot;Activities&quot;: [
              {
                  &quot;ActivityId&quot;: &quot;4f436d11-7a61-4e7f-b0fb-0f0d5bb6be76&quot;,
                  &quot;ActivityDateTime&quot;: &quot;2021-04-30T09:35:35.32Z&quot;,
                  &quot;UpdatedDateTime&quot;: &quot;2021-05-03T07:45:21.5115588Z&quot;,
                  &quot;Metadata&quot;: [
                      {
                          &quot;Name&quot;: &quot;name&quot;,
                          &quot;Value&quot;: &quot;value&quot;
                      }
                  ]
              },
              {
                  &quot;ActivityId&quot;: &quot;659e62c5-4408-42b4-8719-b8c577221d22&quot;,
                  &quot;ActivityDateTime&quot;: &quot;2021-04-30T09:35:35.32Z&quot;,
                  &quot;UpdatedDateTime&quot;: &quot;2021-05-03T07:45:21.5115588Z&quot;,
                  &quot;Metadata&quot;: null
              }
          ]
  </code></pre>
  <p>To display the data, I am having class <code>DisplayActivtiesResponse.cs</code> below:</p>
  <pre><code>public class DisplayActivtiesResponse
  {
  public IEnumerable&lt;DisplayActivity&gt; DisplayActivties{ get; set; }
  }
  
  public class DisplayActivity
  {
  public Guid ActivityId { get ;set; }
  public DateTime ActivityDateTime { get; set; }
  public DateTime UpdatedDateTime { get; set; }
  public IEnumerable&lt;MetaData&gt; MetaData { get; set; }
  }
  
  public class MetaData
  {
  public string Name { get; set; }
  public string Value { get; set; }
  }
  </code></pre>
  <p>Below is the code to fetch the data from DB:</p>
  <pre><code> public async Task&lt;DisplayActivtiesResponse&gt; DisplayActivityAsync(Guid activityId)
          {
              var feedIterator = this.cosmosReviewRequestContainer.GetItemLinqQueryable&lt;ActivitiesDB&gt;()
                  .Where(q =&gt; q.Activities.Where(x =&gt; x.ActivityId == activityId)
                  .ToFeedIterator();
              var requestModel = new ActivitiesDB();
              while (feedIterator.HasMoreResults)
              {
                  var items = await feedIterator.ReadNextAsync().ConfigureAwait(false);
                  requestModel = items.FirstOrDefault();
              }
  
              return new DisplayActivtiesResponse
              {
                  DisplayActivties = mapper.Map&lt;IEnumerable&lt;DisplayActivity&gt;&gt;(requestModel);
              };
          }
  
  </code></pre>
  <p>MappingProfile.cs:</p>
  <pre><code> public class MappingProfile : Profile
      {
          public MappingProfile()
          {
              this.CreateMap&lt;Activity, DisplayActivity&gt;().ReverseMap();
          }
      }
  </code></pre>
  <p>Now, When I am fetching the data from db, I observed that if the metadata is null, I am getting empty array <code>[]</code> instead of <code>null</code>. I still dont know what i am missing from my end. Kindly help me on this.</p>