Sort messages.