Add abstract serializer and deserializer

This PR introduces the abstract serializer and deserializer as well as an initial version of a message.
This looks as you would do a unref and use the object afterwards and got me the first time I looked at it. Are there any benefits for doing the unref before the other code? If not, I'd like to suggest you move the code below the if block.

If there are benefits, please add a blank line.