Update messaging.js

Updated code to reflect more proper way of handling the check of an array in Utils.isArray function. Updated the toArray function to use the Utils variable instead of this, for scope concerns.