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;
    }