done and tested with saving messages in db