I have an single array of Hierarchical categories. Index of the array is the category_id like::
[8846] => Array
    (
        [category_id] => 8846
        [title] => Tsting two
        [description] => Tsting two
        [subtype] => categories
        [type] => object
        [level] => 2
        [parent_category] => 8841
        [tags] => new
        [name] => Tsting two
    )
each value has its parent_category value, I have around 500 elements in the array, what is the best way to make it.
Process i followed:
krsort categories array, so that all the child categories are at the beginning, then
function makeHierarchical() {
  foreach($this->categories as $guid => $category) {
    if($category['level'] != 1)
    $this->multilevel_categories[$category['parent_category']][$guid] = $category;
}
}
but this is not working, it does it only for first level.
Can someone point out me the error.