code: private AggregatedAppendOperation getOrCreateAggregatedAppend(long operationOffset, long operationSequenceNumber) {
          AggregatedAppendOperation aggregatedAppend = null;
          if (this.operations.size() > 0) {
              StorageOperation last = this.operations.getLast();
              if (last.getLength() < this.config.getMaxFlushSizeBytes() && isAppendOperation(last)) {
                  aggregatedAppend = (AggregatedAppendOperation) last;
                  if (aggregatedAppend.isSealed()) {
                      aggregatedAppend = null;
                  }
              }
          }
  
          if (aggregatedAppend == null) {
              // No operations or last operation not an AggregatedAppend - create a new one, while making sure the first
              // offset is not below the current StorageLength (otherwise we risk re-writing data that's already in Storage).
              long offset = Math.max(operationOffset, this.metadata.getStorageLength());
              aggregatedAppend = new AggregatedAppendOperation(this.metadata.getId(), offset, operationSequenceNumber);
              this.operations.add(aggregatedAppend);
          }
  
          return aggregatedAppend;
      }
docs: Gets an existing AggregatedAppendOperation or creates a new one to add the given operation to.
  An existing AggregatedAppend will be returned if it meets the following criteria:
  * It is the last operation in the operation queue.
  * Its size is smaller than maxLength.
  * It is not sealed (already flushed).
  <p>
  If at least one of the above criteria is not met, a new AggregatedAppend is created and added at the end of the
  operation queue.
  
  @param operationOffset         The Segment Offset of the operation to add.
  @param operationSequenceNumber The Sequence Number of the operation to add.
  @return The AggregatedAppend to use (existing or freshly created).