docs: private Integer createObjectAndRegisterPrefix(String field, IndexOutput out,
        BytesRef term, Long termRef, int startPosition, BytesRef payload,
        Integer startOffset, Integer endOffset, IndexOutput outPrefix)
        throws IOException {
      try {
        Integer mtasId = null;
        String prefix = MtasToken.getPrefixFromValue(term.utf8ToString());
        if (payload != null) {
          MtasPayloadDecoder payloadDecoder = new MtasPayloadDecoder();
          payloadDecoder.init(startPosition, Arrays.copyOfRange(payload.bytes,
              payload.offset, (payload.offset + payload.length)));
          mtasId = payloadDecoder.getMtasId();
          Integer mtasParentId = payloadDecoder.getMtasParentId();
          byte[] mtasPayload = payloadDecoder.getMtasPayload();
          MtasPosition mtasPosition = payloadDecoder.getMtasPosition();
          MtasOffset mtasOffset = payloadDecoder.getMtasOffset();
          if (mtasOffset == null && startOffset != null) {
            mtasOffset = new MtasOffset(startOffset, endOffset);
          }
          MtasOffset mtasRealOffset = payloadDecoder.getMtasRealOffset();
          // only if really mtas object
          if (mtasId != null) {
            // compute flags
            int objectFlags = 0;
            if (mtasPosition != null) {
              if (mtasPosition.checkType(MtasPosition.POSITION_RANGE)) {
                objectFlags = objectFlags
                    | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE;
                registerPrefixStatsRangePositionValue(field, prefix, outPrefix);
              } else if (mtasPosition.checkType(MtasPosition.POSITION_SET)) {
                objectFlags = objectFlags
                    | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET;
                registerPrefixStatsSetPositionValue(field, prefix, outPrefix);
              } else {
                registerPrefixStatsSinglePositionValue(field, prefix, outPrefix);
              }
            } else {
              throw new IOException("no position");
            }
            if (mtasParentId != null) {
              objectFlags = objectFlags
                  | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT;
            }
            if (mtasOffset != null) {
              objectFlags = objectFlags
                  | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET;
            }
            if (mtasRealOffset != null) {
              objectFlags = objectFlags
                  | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET;
            }
            if (mtasPayload != null) {
              objectFlags = objectFlags
                  | MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD;
            }
            // create object
            out.writeVInt(mtasId);
            out.writeVInt(objectFlags);
            if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) {
              out.writeVInt(mtasParentId);
            }
            if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) {
              int tmpStart = mtasPosition.getStart();
              out.writeVInt(tmpStart);
              out.writeVInt((mtasPosition.getEnd() - tmpStart));
            } else if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) {
              int[] positions = mtasPosition.getPositions();
              out.writeVInt(positions.length);
              int tmpPrevious = 0;
              for (int position : positions) {
                out.writeVInt((position - tmpPrevious));
                tmpPrevious = position;
              }
            } else {
              out.writeVInt(mtasPosition.getStart());
            }
            if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) {
              int tmpStart = mtasOffset.getStart();
              out.writeVInt(mtasOffset.getStart());
              out.writeVInt((mtasOffset.getEnd() - tmpStart));
            }
            if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) {
              int tmpStart = mtasRealOffset.getStart();
              out.writeVInt(mtasRealOffset.getStart());
              out.writeVInt((mtasRealOffset.getEnd() - tmpStart));
            }
            if ((objectFlags
                & MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) {
              if (mtasPayload != null) {
                out.writeVInt(mtasPayload.length);
                out.writeBytes(mtasPayload, mtasPayload.length);
              } else {
                out.writeVInt(0);
              }
            }
            out.writeVLong(termRef);
          } // storage token
        }
        return mtasId;
      } catch (Exception e) {
        log.error(e);
        throw new IOException(e);
      }
    }