Changed the order of the message saving