@staticmethod
    def survey_section_duplicate(item):

        data = item.data
        name = data.get("name")
        template = data.get("template_id")
        table = item.table
        query = (table.name == name) & \
                (table.template_id == template)
        duplicate = current.db(query).select(table.id,
                                             limitby=(0, 1)).first()
        if duplicate:
            item.id = duplicate.id
            item.method = item.METHOD.UPDATE

# =============================================================================
Rules for finding a duplicate:
dataset/ETHPy150Open sahana/eden/modules/s3db/survey.py/S3SurveyTemplateModel.survey_section_duplicate