Refactored path specific serialization to utility class.