completed CRUD functions for messages, including tests