public static function aggregate($array, $specialKeys = self::SPECIALS_KEYS, $prefix = '')
    {
        $new = [];
        foreach ($array as $key => $value) {
            $newKey = (!empty($prefix)) ? $prefix . '.' . $key : $key;
            if (!in_array($key, $specialKeys, true) && !in_array($key, array_keys($specialKeys), true)) {
                if (is_a($value, "stdClass")) {
                    $value = (array) $value;
                }

                if (is_array($value)) {
                    $new += self::aggregate($value, $specialKeys, $newKey);
                } else {
                    $new[$newKey] = $value;
                }
            } else {
                if (array_key_exists($key, $specialKeys) && is_callable($specialKeys[$key])) {
                    $new = call_user_func($specialKeys[$key], $prefix, $key, $value, $new);
                }
            }
        }

        return $new;
    }