def METHOD_NAME(page, action, language):
    """
    Try updating each type of page extension one-by-one until one works (because we don't know
    to which type of page extension this page is related).
    """
    for method in [
        apply_es_action_to_course,
        apply_es_action_to_category,
        apply_es_action_to_organization,
        apply_es_action_to_person,
    ]:
        try:
            # The method should raise an ObjectDoesNotExist exception if the page extension
            # linked to this page is of another type.
            method(page, action, language)
        except ObjectDoesNotExist:
            continue
        else:
            return