/**
  * {@inheritdoc}
  */
 public function write($id, $data)
 {
     try {
         $params = ['id' => $id, 'data' => base64_encode($data), 'time' => date('Y-m-d H:i:s')];
         if (null !== ($sql = $this->getMergeSql())) {
             $this->connection->executeQuery($sql, $params);
             return true;
         }
         $this->connection->beginTransaction();
         try {
             $this->connection->delete($this->table, ['id' => $id]);
             $this->connection->insert($this->table, $params);
             $this->connection->commit();
         } catch (ConnectionException $e) {
             $this->connection->rollback();
             throw $e;
         }
     } catch (\PDOException $e) {
         throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e);
     }
     return true;
 }