Have you tried the serialization activities in the WebAPI before you had to implement the serialization logic?