public function write($id, $data)
    {
        $idColumn       = $this->options->getIdColumn();
        $nameColumn     = $this->options->getNameColumn();
        $dataColumn     = $this->options->getDataColumn();
        $modifiedColumn = $this->options->getModifiedColumn();
        $createdColumn  = $this->options->getCreatedColumn();
        $lifetimeColumn = $this->options->getLifetimeColumn();
        $adapter        = $this->getAdapter();

        $sessionData = [
            $idColumn   => $id,
            $nameColumn => $this->sessionName
        ];

        $session = $adapter->select($sessionData);

        $sessionData[$dataColumn]     = $this->sanitizeDataWrite($id, $data);
        $sessionData[$modifiedColumn] = new DateTime();

        if ($session) {
            return (bool) $adapter->update($session, $sessionData);
        }

        $sessionData[$lifetimeColumn] = $this->lifetime;
        $sessionData[$createdColumn]  = new DateTime();

        /** @noinspection PhpUndefinedMethodInspection */
        return (bool) $adapter->insert($sessionData);
    }