moved logic from Avro module to Core