refactoring protobuffer serializers