@Override
    public void toData(DataOutput out,
        SerializationContext context) throws IOException {
      DistributedRegion region = (DistributedRegion) event.getRegion();
      setDeltaFlag(region);
      super.toData(out, context);

      byte extraFlags = deserializationPolicy;
      if (eventId != null) {
        extraFlags |= HAS_EVENTID;
      }
      if (deserializationPolicy != DistributedCacheOperation.DESERIALIZATION_POLICY_NONE
          && sendDeltaWithFullValue && event.getDeltaBytes() != null) {
        extraFlags |= HAS_DELTA_WITH_FULL_VALUE;
      }
      if (!event.isGenerateCallbacks()) {
        extraFlags |= DO_NOT_GENERATE_CALLBACKS;
      }
      out.writeByte(extraFlags);

      if (eventId != null) {
        InternalDataSerializer.invokeToData(eventId, out);
        if (region instanceof BucketRegion) {
          PartitionedRegion pr = region.getPartitionedRegion();
          // TODO Kishor: Since here we are talking about tail key
          // then we are surely considering Paralle Gateway
          if (!pr.isParallelWanEnabled()) {
            out.writeBoolean(false);
          } else {
            out.writeBoolean(true);
            out.writeLong(event.getTailKey());
          }
        } else {
          out.writeBoolean(false);
        }
      }
      DataSerializer.writeObject(key, out);

      if (hasDelta()) {
        DataSerializer.writeByteArray(event.getDeltaBytes(), out);
        event.getRegion().getCachePerfStats().incDeltasSent();
      } else {
        DistributedCacheOperation.writeValue(deserializationPolicy, newValueObj,
            newValue, out);
        if ((extraFlags & HAS_DELTA_WITH_FULL_VALUE) != 0) {
          DataSerializer.writeByteArray(event.getDeltaBytes(), out);
        }
      }
    }
Utility to set the new value in the EntryEventImpl based on the given deserialization value;
also called from QueuedOperation
geode-core/src/main/java/org/apache/geode/internal/cache/UpdateOperation.java