Wp 684 refactor handle message func

http://jira.webinos.org/browse/WP-648