'Update realm entity in all related HRs
@todo: clean up records which RESTRICT the site_id'

@staticmethod
def org_site_ondelete_cascade(form):

    site_id = form.site_id
    htable = current.s3db.hrm_human_resource
    query = (htable.site_id == site_id)
    db = current.db
    rows = db(query).select(htable.id)
    db(query).update(site_id=None)
    current.auth.set_realm_entity(htable, rows, force_update=True)
