public IList <IPrepareLogRecord <TStreamId> > CreatePrepareLogRecords(string stream, int expectedVersion, IList <string> eventTypes, IList <Guid> eventIds, long transactionPosition)
        {
            if (eventIds.Count != eventTypes.Count)
            {
                throw new Exception("eventType and eventIds length mismatch!");
            }
            if (eventIds.Count == 0)
            {
                throw new Exception("eventIds is empty");
            }
            if (eventIds.Count == 1)
            {
                return(CreatePrepareLogRecord(stream, expectedVersion, eventTypes[0], eventIds[0], transactionPosition));
            }

            var numEvents = eventTypes.Count;
            var logFormat = LogFormatHelper <TLogFormat, TStreamId> .LogFormat;

            var prepares = new List <IPrepareLogRecord <TStreamId> >();

            logFormat.StreamNameIndex.GetOrAddId(stream, out var streamId, out _, out _);
            for (var i = 0; i < numEvents; i++)
            {
                PrepareFlags flags = PrepareFlags.Data | PrepareFlags.IsCommitted;
                if (i == 0)
                {
                    flags |= PrepareFlags.TransactionBegin;
                }
                if (i == numEvents - 1)
                {
                    flags |= PrepareFlags.TransactionEnd;
                }

                prepares.Add(
                    PrepareLogRecord.Prepare(
                        logFormat.RecordFactory,
                        transactionPosition + RecordOffset * i,
                        Guid.NewGuid(),
                        eventIds[i],
                        transactionPosition,
                        i,
                        streamId,
                        expectedVersion + i,
                        flags,
                        eventTypes[i],
                        new byte[0],
                        new byte[0],
                        DateTime.Now
                        ));
            }

            return(prepares);
        }