private function loadServices(array $config, ContainerBuilder $container)
    {
        if ('fos_user.util.canonicalizer.default' === $config['service']['username_canonicalizer']) {
            $config['service']['username_canonicalizer'] = 'fos_user.util.username_canonicalizer';
        }

        if ('fos_user.util.canonicalizer.default' === $config['service']['email_canonicalizer']) {
            $config['service']['email_canonicalizer'] = 'fos_user.util.email_canonicalizer';
        }

        // Only create a UserManager service when not using a custom one
        if ('fos_user.user_manager.default' === $config['service']['user_manager']) {
            $config['service']['user_manager'] = $this->createUserManager($config, $container);
        }

        if (sprintf('%s.user_manager', $this->servicePrefix) !== $config['service']['user_manager']) {
            $container->setAlias(sprintf('%s.user_manager', $this->servicePrefix), $config['service']['user_manager']);
        }

        $container->setDefinition(sprintf('%s.user_provider.username', $this->servicePrefix), new DefinitionDecorator('fos_user.user_provider.username'))
        ->replaceArgument(0, new Reference(sprintf('%s.user_manager', $this->servicePrefix)))
        ->setPublic(false);

        $container->setDefinition(sprintf('%s.user_provider.username_email', $this->servicePrefix), new DefinitionDecorator('fos_user.user_provider.username_email'))
        ->replaceArgument(0, new Reference(sprintf('%s.user_manager', $this->servicePrefix)))
        ->setPublic(false);

        $container->setDefinition(sprintf('%s.user_manipulator', $this->servicePrefix), new DefinitionDecorator('fos_user.util.user_manipulator'))
        ->replaceArgument(0, new Reference(sprintf('%s.user_manager', $this->servicePrefix)));

        $container->setDefinition(sprintf('%s.listener.authentication', $this->servicePrefix), new DefinitionDecorator('fos_user.listener.authentication'))
        ->replaceArgument(1, sprintf('%%%s.firewall_name%%', $this->servicePrefix))
        ->addTag('kernel.event_subscriber');
    }