code: private byte[] toBytes(Object object, Schema writer, Integer writerVersion) {
  
          ByteArrayOutputStream output = new ByteArrayOutputStream();
          Encoder encoder = new BinaryEncoder(output);
          GenericDatumWriter<Object> datumWriter = null;
  
          output.write(writerVersion.byteValue());
          try {
              datumWriter = new GenericDatumWriter<Object>(writer);
              datumWriter.write(object, encoder);
              encoder.flush();
          } catch(IOException e) {
              throw new SerializationException(e);
          } catch(SerializationException sE) {
              throw sE;
          } finally {
              SerializationUtils.close(output);
          }
  
          return output.toByteArray();
  
      }
docs: /*
  Serialize a given object using a non latest schema With auto rebootstrap
  the client gets the latest schema updated on the server However an
  application may still create objects using an old schema this lets us
  serialize those objects without an exception