Refactoring JSON serialization of cookies in .NET