MDL-45594 core_message: altered queries to order by timecreated, rather than id.
MDL-45594 core_message: commented on query change
MDL-45594 core_message: added unit tests