protected function createDeliveryResource(core_kernel_classes_Class $deliveryClass, \tao_models_classes_service_ServiceCall $serviceCall,
        $container, $properties = array()) {

        $properties[DeliveryAssemblyService::PROPERTY_DELIVERY_TIME]      = time();
        $properties[DeliveryAssemblyService::PROPERTY_DELIVERY_RUNTIME]   = $serviceCall->toOntology();
        if (!isset($properties[DeliveryContainerService::PROPERTY_RESULT_SERVER])) {
            $properties[DeliveryContainerService::PROPERTY_RESULT_SERVER] = \taoResultServer_models_classes_ResultServerAuthoringService::singleton()->getDefaultResultServer();
        }
        if (!is_null($container)) {
            $properties[ContainerRuntime::PROPERTY_CONTAINER] = json_encode($container);
        }

        if ($this->deliveryResource instanceof core_kernel_classes_Resource) {
            $compilationInstance = $this->deliveryResource;
            $compilationInstance->setPropertiesValues($properties);
        } else {
            $compilationInstance = $deliveryClass->createInstanceWithProperties($properties);
        }

        $eventManager = $this->getServiceManager()->get(EventManager::SERVICE_ID);
        $eventManager->trigger(new DeliveryCreatedEvent($compilationInstance->getUri()));
        return $compilationInstance;
    }