public function apply($characterSet, $collation, $connectionName = '', $environment = '', callable $messageCallback = null, ErrorList $warnings = null)
    {
        if ($messageCallback === null) {
            $messageCallback = function ($message) { };
        }
        if ((string) $connectionName === '') {
            $connectionName = $this->databaseManager->getDefaultConnection();
        }
        $connection = $this->databaseManager->connection($connectionName);
        list($characterSet, $collation) = $this->resolver
            ->setCharacterSet((string) $characterSet)
            ->setCollation((string) $collation)
            ->resolveCharacterSetAndCollation($connection)
        ;
        $messageCallback(t('Setting character set "%1$s" and collation "%2$s" for connection "%3$s"', $characterSet, $collation, $connectionName));
        $this->convertTables($connection, $characterSet, $collation, $messageCallback, $warnings);
        $messageCallback(t('Saving connection configuration.'));
        $this->persistConfiguration($connectionName, $environment, $characterSet, $collation, $warnings);
        $connection->refreshCharactersetCollation($characterSet, $collation);
    }