private static function addSegmentsToPath($path, $segments)
    {
        $segments = Arr::toArray($segments);
        if (count($segments) > 0) {
            $path .= '/' . implode('/', $segments);
        }
        return $path;
    }