private function handleJson ($payload)
    {
        $uploadData = $payload;

        if (is_array($payload))
        {
            $uploadData = json_encode($payload);
        }
        else if ($payload instanceof Converter)
        {
            $uploadData = $payload->toJson();
        }
        else if (!StringUtilities::isJson($payload))
        {
            throw new \InvalidArgumentException("The given data is not valid JSON");
        }

        return $uploadData;
    }