public async Task <string> CreateBatchDocument(string requestId, RetryType retryType, string[] failedMessageRetryIds, string originator, DateTime startTime, DateTime?last = null, string batchName = null, string classifier = null)
        {
            var batchDocumentId = RetryBatch.MakeDocumentId(Guid.NewGuid().ToString());

            using (var session = store.OpenAsyncSession())
            {
                await session.StoreAsync(new RetryBatch
                {
                    Id               = batchDocumentId,
                    Context          = batchName,
                    RequestId        = requestId,
                    RetryType        = retryType,
                    Originator       = originator,
                    Classifier       = classifier,
                    StartTime        = startTime,
                    Last             = last,
                    InitialBatchSize = failedMessageRetryIds.Length,
                    RetrySessionId   = RetrySessionId,
                    FailureRetries   = failedMessageRetryIds,
                    Status           = RetryBatchStatus.MarkingDocuments
                }).ConfigureAwait(false);

                await session.SaveChangesAsync().ConfigureAwait(false);
            }

            return(batchDocumentId);
        }
        public string CreateBatchDocument(string requestId, RetryType retryType, int initialBatchSize, string originator, DateTime startTime, DateTime?last = null, string batchName = null, string classifier = null)
        {
            var batchDocumentId = RetryBatch.MakeDocumentId(Guid.NewGuid().ToString());

            using (var session = store.OpenSession())
            {
                session.Store(new RetryBatch
                {
                    Id               = batchDocumentId,
                    Context          = batchName,
                    RequestId        = requestId,
                    RetryType        = retryType,
                    Originator       = originator,
                    Classifier       = classifier,
                    StartTime        = startTime,
                    Last             = last,
                    InitialBatchSize = initialBatchSize,
                    RetrySessionId   = RetrySessionId,
                    Status           = RetryBatchStatus.MarkingDocuments
                });
                session.SaveChanges();
            }
            return(batchDocumentId);
        }