title: Transform array of objects to nested array
body: <p>I have the array of objects</p>
  
  <pre><code>[  
   { id: 1, parent_id: null, title: 'Title 1' },
   { id: 2, parent_id: 1, title: 'Title2' },
   { id: 3, parent_id: 2, title: 'Title 3' },
   { id: 4, parent_id: null, title: 'Title 4' }  
  ]
  </code></pre>
  
  <p>I need to transform this array to this</p>
  
  <pre><code>[ 
    { 
      id: 1,
      parent_id: null,
      children: [  
          { 
            id: 2,
            parent_id: 1,
            title: 'Title2',
            children: [ 
              {  id: 3, parent_id: 2, title: "Title 3" } 
            ] 
          }
      ]
    },  
    {id: 4, parent_id: null, title: 'Title 4' } 
  ] 
  </code></pre>
  
  <p>I have no idea, how can do this</p>