protected Object updateSchemaIn(Object keyOrValue, Schema updatedSchema) {
        if (keyOrValue instanceof Struct) {
            Struct origStruct = (Struct) keyOrValue;
            Struct newStruct = new Struct(updatedSchema);
            for (Field field : updatedSchema.fields()) {
                // assume both schemas have exact same fields with same names and schemas ...
                newStruct.put(field, getFieldValue(origStruct, field));
            }
            return newStruct;
        }
        return keyOrValue;
    }
Utility to check the supplied key or value for references to the old Schema,
and if so to return an updated key or value object that references the new Schema.
Note that this method assumes that the new Schema may have a different name and/or version,
but has fields that exactly match those of the old Schema.
<p>
Currently only {@link Struct} objects have references to the {@link Schema}.

@param keyOrValue    the key or value object; may be null
@param updatedSchema the updated schema that has been potentially renamed
@return the original key or value object if it does not reference the old schema, or
a copy of the key or value object with updated references to the new schema.
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/SetSchemaMetadata.java