Factor out more XML serialization logic into the representation classes