code: public BsonDocument toBsonDocument() {
      final BsonDocument asDoc = new BsonDocument();
      asDoc.put(Fields.OPERATION_TYPE_FIELD, new BsonString(getOperationType().toRemote()));
      asDoc.put(Fields.DOCUMENT_KEY_FIELD, getDocumentKey());
  
      if (getFullDocument() != null && (getFullDocument() instanceof BsonValue)
          && ((BsonValue) getFullDocument()).isDocument()) {
        asDoc.put(Fields.FULL_DOCUMENT_FIELD, (BsonValue) getFullDocument());
      }
  
      if (getUpdateDescription() != null) {
        asDoc.put(Fields.UPDATE_DESCRIPTION_FIELD, getUpdateDescription().toBsonDocument());
      }
  
      if (stitchDocumentVersion != null) {
        asDoc.put(Fields.STITCH_DOCUMENT_VERSION_FIELD, stitchDocumentVersion.toBsonDocument());
      }
  
      if (stitchDocumentHash != null) {
        asDoc.put(Fields.STITCH_DOCUMENT_HASH_FIELD, new BsonInt64(stitchDocumentHash));
      }
  
      asDoc.put(Fields.WRITE_PENDING_FIELD, new BsonBoolean(hasUncommittedWrites()));
      return asDoc;
    }
docs: Serializes this change event into a {@link BsonDocument}.
  @return the serialized document.