public function localizeDeepArray(?array $arr, string $group, int $depth = 1, ?string $lang = null): ?array
    {
        if ($arr === null) {
            return null;
        }
        
        if ($depth < 0) {
            throw new \InvalidArgumentException("Depth must be a non-negative integer, $depth given");
        }
        
        if ($depth) {
            foreach ($arr as $key => &$value) {
                if (!is_array($value)) {
                    throw new \LengthException("Exceeded depth when localizing deep array");
                }
                $value = $this->localizeDeepArray($value, $group, $depth - 1, $lang);
            }
            unset($value);
            return $arr;
        }
        
        return $this->flatten($arr, $group, $lang);
    }