Improve code layout of ObjectSerializer.cs