protected function prepareRelatedRecord($relationName, array $relationRecordData, $index = null) {
        $recordWithBackup = $relationRecordData;
        $valueViewers = $this->getViewersForRelations();
        foreach ($relationRecordData as $columnName => $value) {
            $viewerName = $relationName . '.' . ($index === null ? '' : $index . '.') . $columnName;
            if (
                array_key_exists($viewerName, $valueViewers)
                && $valueViewers[$viewerName]->getRelation()->getName() === $relationName
            ) {
                $recordWithBackup[$columnName] = $recordWithBackup['__' . $columnName] = $value;
                $valueViewer = $valueViewers[$viewerName];
                if (
                    is_object($valueViewer)
                    && method_exists($valueViewer, 'convertValue')
                    && (
                        !method_exists($valueViewer, 'isVisible')
                        || $valueViewer->isVisible()
                    )
                ) {
                    $recordWithBackup[$columnName] = $valueViewer->convertValue(
                        $recordWithBackup[$columnName],
                        $relationRecordData
                    );
                }
            }
        }
        return $recordWithBackup;
    }