Sort the applications by app-id when exporting to XML

This means we maintain the order when applications are updated.