private List<IndexEntry> addPutEntries(Offset prevEntryEndOffset, IndexSegment indexSegment, int count, long size,
      long expiresAtMs, int idLength, boolean createV0IndexValue) throws StoreException {
    List<IndexEntry> indexEntries = new ArrayList<>();
    for (int i = 0; i < count; i++) {
      state.appendToLog(size);
      FileSpan fileSpan = state.log.getFileSpanForMessage(prevEntryEndOffset, size);
      IndexEntry entry;
      MockId putId = state.getUniqueId(idLength);
      short accountId = Utils.getRandomShort(TestUtils.RANDOM);
      short containerId = Utils.getRandomShort(TestUtils.RANDOM);
      if (indexSegment != null) {
        entry = new IndexEntry(putId,
            IndexValueTest.getIndexValue(size, prevEntryEndOffset, expiresAtMs, state.time.milliseconds(), accountId,
                containerId, (short) 0, indexSegment.getVersion()));
        indexSegment.addEntry(entry, fileSpan.getEndOffset());
      } else {
        entry = new IndexEntry(putId,
            IndexValueTest.getIndexValue(size, prevEntryEndOffset, expiresAtMs, state.time.milliseconds(), accountId,
                containerId, (short) 0,
                createV0IndexValue ? PersistentIndex.VERSION_0 : PersistentIndex.CURRENT_VERSION));
        state.index.addToIndex(entry, fileSpan);
      }
      indexEntries.add(entry);
      prevEntryEndOffset = fileSpan.getEndOffset();
    }
    return indexEntries;
  }
Adds {@link IndexEntry}s to the given {@link IndexSegment} for {@link IndexValue}s of version
{@link PersistentIndex#VERSION_0} or {@link PersistentIndex#VERSION_1} or to the actual {@link PersistentIndex} for
{@link IndexValue}s of version {@link PersistentIndex#CURRENT_VERSION}
@param prevEntryEndOffset end offset of last {@link IndexEntry}
@param indexSegment the {@link IndexSegment} to which put entries need to be added. If {@code null},
                    {@link IndexEntry}s will be added to the {@link PersistentIndex}
@param count total count of put entries to be added
@param size size of put entries
@param expiresAtMs expiration value at ms for the put entries
@param createV0IndexValue if true, create {@link IndexValue} in V0.
@return a list {@link IndexEntry}s added to the {@link PersistentIndex}
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/IndexTest.java