Use the Bundle builder for serialization.

This looks a bit neater and involves slightly less copying when
metadata is serialized. Also serialize '_' properties when not
in lite mode.