protected function getPivotValues(string $relation, InternallyMappable $entity): array
    {
        $values = [];

        $entityAttributes = $entity->getEntityAttributes();

        if (array_key_exists($relation, $this->pivotAttributes)) {
            foreach ($this->pivotAttributes[$relation] as $attribute) {
                if (array_key_exists($attribute, $entityAttributes)) {
                    $values[$attribute] = $entity->getEntityAttribute('pivot')->$attribute;
                }
            }
        }

        return $values;
    }