Header metadata serialization

As it's Govspeak that parses and creates this nested header data-
structure it seems sensible to put the serialization logic here too.
The serialization itself is trivial and the recursive nature can be
expressed here very simply, with parents serialzing their children.
This is a huge win for clients of this data who need not re-invent
their own recursive serialization logic.