def METHOD_NAME(record):
    record.parent.communities.remove(community._record)
    record.parent.communities.add(community2._record, default=False)
    record.parent.commit()
    record.commit()
    db.session.commit()
    current_rdm_records_service.indexer.index(record)
    RDMRecord.index.refresh()
    return record