public function createDeployment(
        $name,
        $deploymentName,
        $slot,
        $packageUrl,
        $configuration,
        $label,
        CreateDeploymentOptions $options = null
    ) {
        Validate::isString($name, 'name');
        Validate::notNullOrEmpty($name, 'name');
        Validate::isString($deploymentName, 'deploymentName');
        Validate::notNullOrEmpty($deploymentName, 'deploymentName');
        Validate::isString($slot, 'slot');
        Validate::notNullOrEmpty($slot, 'slot');
        Validate::isTrue(
            DeploymentSlot::isValid($slot),
            sprintf(Resources::INVALID_SLOT, $slot)
        );
        Validate::isString($packageUrl, 'packageUrl');
        Validate::notNullOrEmpty($packageUrl, 'packageUrl');
        Validate::isString($configuration, 'configuration');
        Validate::notNullOrEmpty($configuration, 'configuration');
        Validate::isString($label, 'label');
        Validate::notNullOrEmpty($label, 'label');

        if (is_null($options)) {
            $options = new CreateDeploymentOptions();
        }

        $configuration = $this->_encodeConfiguration($configuration);

        $startDeployment = Utilities::booleanToString(
            $options->getStartDeployment()
        );
        $treatWarningsAsErrors = Utilities::booleanToString(
            $options->getTreatWarningsAsErrors()
        );
        $xmlElements = [
            Resources::XTAG_NAME => $deploymentName,
            Resources::XTAG_PACKAGE_URL => $packageUrl,
            Resources::XTAG_LABEL => $label,
            Resources::XTAG_CONFIGURATION => $configuration,
            Resources::XTAG_START_DEPLOYMENT => $startDeployment,
            Resources::XTAG_TREAT_WARNINGS_AS_ERROR => $treatWarningsAsErrors,
        ];
        $requestXml = $this->_createRequestXml(
            $xmlElements,
            Resources::XTAG_CREATE_DEPLOYMENT
        );

        $context = new HttpCallContext();
        $context->setMethod(Resources::HTTP_POST);
        $context->setPath($this->_getDeploymentPathUsingSlot($name, $slot));
        $context->addStatusCode(Resources::STATUS_ACCEPTED);
        $context->setBody($requestXml);
        $context->addHeader(
            Resources::CONTENT_TYPE,
            Resources::XML_CONTENT_TYPE
        );

        $response = $this->sendHttpContext($context);

        return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
    }