Mail Rule Sort

I have over 40 rules in mail.app and would like to sort them by name.

Any ideas?

There’s no propertiy for order, at least not in the old version I have. I think you’d have to loop through them and store the properties, delete them all, sort the stored info records by name, and then recreate them.

I tried that and although I can run an applescript loop to delete the messages, I am unable to write a script that will copy or duplicate the rules. I thought if I could copy or duplicate the rules and then delete the original, then I could bubble sort the rules by their names.
As a result, the only method I know to sort the rules is by manually selecting a rule and then dragging it to a new place and then repeating the process for each rule until the whole list is sorted by alpha order.

Any ideas?