refactoring: extract GPX serialization to make it testable