public function buildUrl(string $url, array $parameters = []) : string
    {
        if ($parameters) {
            foreach ($parameters as $key => $value) {
                if ($value === null) {
                    unset($parameters[$key]);
                }

                if (is_object($value)) {
                    $packedObject = $this->objectPacker->pack($value);

                    if ($packedObject === null) {
                        throw new \RuntimeException('Cannot pack object ' . get_class($value));
                    }

                    $parameters[$key] = $packedObject->getData();
                }
            }
        }

        $pos = strpos($url, '?');
        if ($pos !== false) {
            parse_str(substr($url, $pos + 1), $query);
            $parameters += $query;

            $url = substr($url, 0, $pos);
        }

        if ($parameters) {
            return $url . '?' . http_build_query($parameters);
        }

        return $url;
    }