'Import item de-duplication'

@staticmethod
def org_facility_duplicate(item):

    data = item.data
    name = data.get('name')
    org = data.get('organisation_id')
    table = item.table
    query = (table.name.lower() == s3_unicode(name).lower())
    if org:
        query = (query & ((table.organisation_id == org) | (table.organisation_id == None)))
    duplicate = current.db(query).select(table.id, limitby=(0, 1)).first()
    if duplicate:
        item.id = duplicate.id
        item.method = item.METHOD.UPDATE
