protected function getMetaModelFromModel(ModelInterface $model)
    {
        if (!(($model->getProviderName() == 'tl_metamodel_dca_sortgroup') && $model->getProperty('pid'))) {
            throw new DcGeneralInvalidArgumentException(
                sprintf(
                    'Model must originate from tl_metamodel_dca_sortgroup and be saved, this one originates from %s ' .
                    'and has pid %s',
                    $model->getProviderName(),
                    $model->getProperty('pid')
                )
            );
        }

        $metaModelId = $this->connection->createQueryBuilder()
            ->select('pid')
            ->from('tl_metamodel_dca')
            ->where('id=:id')
            ->setParameter('id', $model->getProperty('pid'))
            ->execute()
            ->fetchColumn();

        $tableName = $this->factory->translateIdToMetaModelName($metaModelId);

        return $this->factory->getMetaModel($tableName);
    }