def update_priorities(
        cls,
        new_feature_segment_id_priorities: typing.List[typing.Tuple[int, int]],
    ) -> QuerySet["FeatureSegment"]:
        """
        Method to update the priorities of multiple feature segments at once.

        :param new_feature_segment_id_priorities: a list of 2-tuples containing the id, new priority value of
            the feature segments
        :return: a 3-tuple consisting of:
            - a boolean detailing whether any changes were made
            - a list of 2-tuples containing the id, old priority value of the feature segments
            - a queryset containing the updated feature segment model objects
        """
        feature_segments = cls.objects.filter(
            id__in=[pair[0] for pair in new_feature_segment_id_priorities]
        )

        existing_feature_segment_id_priority_pairs = cls.to_id_priority_tuple_pairs(
            feature_segments
        )

        def sort_function(id_priority_pair):  # type: ignore[no-untyped-def]
            priority = id_priority_pair[1]
            return priority

        if sorted(
            existing_feature_segment_id_priority_pairs, key=sort_function
        ) == sorted(new_feature_segment_id_priorities, key=sort_function):
            # no changes needed - do nothing (but return existing feature segments)
            return feature_segments  # type: ignore[no-any-return]

        id_priority_dict = dict(new_feature_segment_id_priorities)

        for fs in feature_segments:
            new_priority = id_priority_dict[fs.id]
            fs.to(new_priority)

        request = getattr(HistoricalRecords.thread, "request", None)
        if request:
            create_segment_priorities_changed_audit_log.delay(
                kwargs={
                    "previous_id_priority_pairs": existing_feature_segment_id_priority_pairs,
                    "feature_segment_ids": [
                        pair[0] for pair in new_feature_segment_id_priorities
                    ],
                    "user_id": getattr(request.user, "id", None),
                    "master_api_key_id": (
                        request.master_api_key.id
                        if hasattr(request, "master_api_key")
                        else None
                    ),
                    "changed_at": timezone.now().isoformat(),
                }
            )

        # since the `to` method updates the priority in place, we don't need to refresh
        # the objects from the database.
        return feature_segments  # type: ignore[no-any-return]

        Method to update the priorities of multiple feature segments at once.

        :param new_feature_segment_id_priorities: a list of 2-tuples containing the id, new priority value of
            the feature segments
        :return: a 3-tuple consisting of:
            - a boolean detailing whether any changes were made
            - a list of 2-tuples containing the id, old priority value of the feature segments
            - a queryset containing the updated feature segment model objects
        
api/features/models.py