Moved out serialization code from value objects to dedicated service objects.

This is based on a suggestion by Tobias Schlitt in the external code
review we got, though it is somewhat simpler then what he suggested.

Change-Id: I07ca8cc2b9981078755fd25617e9251fd0d9ce9f