How to work with received messages