public static function flatten(array $array, $separator = '.', $prefix = '')
    {
        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $newPrefix = empty($prefix) ? $key : "$prefix.$key";
                $result = array_merge($result, self::flatten($value, $separator, $newPrefix));
            } else {
                $newKey = empty($prefix) ? $key : "$prefix.$key";
                $result[$newKey] = $value;
            }
        }

        return $result;
    }