protected function createAndRegisterGateway($platformName, $name, array $config)
    {
        $platform = $this->registry->getPlatform($platformName);

        $gateway = $platform->createGateway($name, $config);

        if ($gateway instanceof Shipment\AddressResolverAwareInterface) {
            $gateway->setAddressResolver($this->registry->getAddressResolver());
        }
        if ($gateway instanceof Shipment\WeightCalculatorAwareInterface) {
            $gateway->setWeightCalculator($this->registry->getWeightCalculator());
        }
        if ($gateway instanceof PersisterAwareInterface) {
            $gateway->setPersister($this->registry->getPersister());
        }

        $this->gateways[$name] = $gateway;
    }