Refactor avro gen classes