Inline method to move serialization code to more sensible location