public function register(ServiceProviderInterface $instance)
{
// check if the service has already been registered
if ($this->getServices()->has($pk = $instance->getPrimaryKey())) {
throw new ServiceAlreadyRegisteredException(sprintf('It is not allowed to register service %s with primary key %s more than on times', $instance->getServiceName(), $pk));
}
// register the service using the primary key
$this->getServices()->set($pk, $instance);
}