def set_record_owners(record_metadata, owners):
    """Set the record's owners, assuming an RDM-Records metadata schema."""
    metadata = record_metadata.copy()

    owners = [{"user": owner.id} for owner in owners]
    if "access" not in metadata:
        metadata["access"] = {}

    metadata["access"]["owned_by"] = owners
    return metadata