refactoring an array
<p>I'm not that very good in refactoring arrays so i hope you guys might be able to help me.
I have the following array:</p>

<pre><code>(Array)#0
  [0] (Object)#1
    description = "blabla"
    image_id = "25"
    name = "partner"
    progress = "1"
    project_id = "8"
    url = "hettrainingsvriendje1.jpg"
  [1] (Object)#2
    description = "blabla"
    image_id = "26"
    name = "Het trainingsvriendje"
    progress = "2"
    project_id = "8"
    url = "hettrainingsvriendje2.jpg"
  [2] (Object)#4
    description = "blabla"
    image_id = "21"
    name = "Het liefdesdraaibed"
    progress = "1"
    project_id = "7"
    url = "hetliefdesdraaibed1.jpg"
  [3] (Object)#4
    description = "blabla"
    image_id = "21"
    name = "Het liefdesdraaibed"
    progress = "1"
    project_id = "7"
    url = "hetliefdesdraaibed2.jpg"
</code></pre>

<p>i would like to refactor the array so that it checks the <code>project_id</code>. If the idea isnt in the new array yet then it can add the project . If the <code>project_id</code> does exist then it should take the url and progress and only add these 2 to the existing item in the array. </p>

<p>The problem is that when the project get added for the first time, it should take out the <code>url</code> and <code>progress</code> from that element, create a new element called <code>images</code>, and add the <code>url</code> and <code>progress</code> into that, so when a item gets added and the <code>project_id</code> exists, the <code>url</code> and <code>progress</code> gets added to the <code>images</code> element, wich at the end would leave me with an array with unique elements and each element would have an item <code>images</code> wich contains several arrays where the <code>url</code> and <code>progress</code> is stored in.</p>
