public function getWriteConnection(Server $preferredServer = null) : IConnection
    {
        if ($preferredServer != null) {
            $this->addServer('custom', $preferredServer);
            $this->setWriteConnection($preferredServer);
        } elseif ($this->writeConnection == null) {
            $this->setWriteConnection();
        }

        return $this->writeConnection;
    }