title: Create an object array from another object array and reconstruct the original object array later using map
body: <p>Consider the following classes</p>
  
  <pre><code>class Category {
         var tag: String?
         var itemList: [Item]?
   }
  
   class Item {
         var id: Int?
         var type: String?
         var itemDetails: ItemDetails?  
   }
  
   class ItemDetails {
         var description: String?
         var name: String?
         var price: Float?
   }
  </code></pre>
  
  <p>Given an array of <strong>Category</strong> objects.</p>
  
  <pre><code>var categoryList: [Category]
  </code></pre>
  
  <p>I want to create a new object array by extracting only the <strong>name</strong> in <strong>ItemDetails</strong>(inorder to apply a filter) and an <strong>id</strong> inorder to reconstruct back array of Category objects.</p>
  
  <p>Hence, I have to reconstruct the array of <strong>Category</strong> objects
  from new object array.</p>
  
  <p>How to do both extraction and reconstruction using the <code>map</code> feature?</p>
  
  <p>Below are the examples of other data sources:</p>
  
  <p><strong>Datasource 1 :</strong></p>
  
  <p><code>var categoryList: [Category]</code>, where <code>name</code> need to be extracted</p>
  
  <p><strong>Datasource 2 :</strong>  </p>
  
  <p><code>var  searchList = [SearchItem]</code>, where title to be extracted.</p>
  
  <pre><code>    Class SearchItem {
           var id: Int?
           var details: SearchItemDetails?
           var type: String? 
      }
  
      Class  SearchItemDetails {               
          var description: String?
          var title: String? 
      }
  </code></pre>
  
  <p><strong>DataSource 3</strong></p>
  
  <p><code>var products:  [Products]</code>, where title to be extracted.</p>
  
  <pre><code>    Class Products {
          var id: Int?
          var details: ProductDetails?
          var type: String? 
      }
  
      class ProductDetails {
          var description: String?
          var title: String? 
      } 
  </code></pre>