protected function &getReferenceForPath(array $path, array &$config)
    {
        $path = array_filter($path, function ($value) {
            return (bool) $value;
        });

        $ref = &$config;

        if (empty($path)) {
            return $ref;
        }

        foreach ($path as $key) {
            if (!isset($ref[$key])) {
                $ref[$key] = [
                    'child_routes' => []
                ];
            }
            $ref = &$ref[$key]['child_routes'];
        }

        return $ref;
    }