protected function getEmbedData(DataObject $record, $relationName)
    {
        if ($record->hasMethod($relationName)) {
            $relationData = $record->$relationName();
            if ($relationData instanceof RelationList) {
                return $this->formatDataList($relationData);
            } else {
                return $this->formatDataObject($relationData);
            }
        }

        return null;
    }