merge function

Merge two messages of the same type