sort messages by createdAt