def _update(qs):
        try:
            with transaction.atomic():
                qs.update(sort_order=models.F('sort_order') + 1)
        except IntegrityError:
            for obj in qs.order_by('-sort_order'):
                qs.filter(pk=obj.pk).update(sort_order=models.F('sort_order') + 1)