response serializing refactoring