public function executeSql($sql, $parameters=[]) {
    if ($this->adapter == null) {
      $this->connect();
    }
    try {
      $stmt = $this->adapter->createStatement($sql, $parameters);
      $results = $stmt->execute();
      if ($results->isQueryResult()) {
        return $results->getResource()->fetchAll();
      }
      else {
        return $results->getAffectedRows();
      }
    }
    catch (\Exception $ex) {
      self::$logger->error("The query: ".$sql."\ncaused the following exception:\n".$ex->getMessage());
      throw new PersistenceException("Error in persistent operation. See log file for details.");
    }
  }