code: private function convertRows(Statement $dbResult, $idColumn, $valueColumn)
      {
          $result = [];
          while ($row = $dbResult->fetch(\PDO::FETCH_ASSOC)) {
              if (!isset($result[$row[$idColumn]])) {
                  $result[$row[$idColumn]] = [];
              }
  
              $data = $row;
              unset($data[$idColumn]);
              $result[$row[$idColumn]][$row[$valueColumn]] = $data;
          }
  
          return $result;
      }
docs: Convert the database result to an result array.
  
  @param Statement $dbResult    The database result.
  @param string    $idColumn    The id column name.
  @param string    $valueColumn The value column name.
  
  @return array