refactor(message) refactored TO and FROM validation method