public static function listToMultiArray($array)
    {
        $nested = [];
        $depths = [];

        foreach ($array as $key => $arr) {

            if ($arr['depth'] == 0) {
                $nested[$key] = $arr;
            } else {
                $parent =& $nested;

                for ($i = 1; $i <= ($arr['depth']); $i++) {
                    $parent =& $parent[$depths[$i]];
                }

                $parent['pages'][$key] = $arr;
            }

            $depths[$arr['depth'] + 1] = $key;
        }

        return $nested;
    }