code: private function fetchExisting($table, $parentId)
      {
          // Keep the sorting value.
          $this->startSort       = 0;
          $this->knownAttributes = [];
  
          $alreadyExisting = $this
              ->connection
              ->createQueryBuilder()
              ->select('*')
              ->from($table)
              ->where('pid=:pid')
              ->setParameter('pid', $parentId)
              ->orderBy('sorting')
              ->execute();
  
          foreach ($alreadyExisting->fetchAll(\PDO::FETCH_ASSOC) as $item) {
              $this->knownAttributes[$item['attr_id']] = $item;
              $this->startSort                         = $item['sorting'];
          }
  
          return $this->knownAttributes;
      }
docs: Fetch existing entries.
  
  @param string $table    The table name to fetch from.
  @param string $parentId The parent id.
  
  @return array