private static async Task IncrementPublishAttemptsForAllPendingItemsAsync(
            this SqlConnection sqlConnection,
            ISqlTransactionalOutboxPublisher <Guid> outboxPublisher
            )
        {
            outboxPublisher.AssertNotNull(nameof(outboxPublisher));

            await using var outboxTransaction = (SqlTransaction)(await sqlConnection.BeginTransactionAsync().ConfigureAwait(false));

            var outboxProcessor  = new DefaultSqlServerTransactionalOutboxProcessor <string>(outboxTransaction, outboxPublisher);
            var outboxRepository = outboxProcessor.OutboxRepository;

            await outboxRepository
            .IncrementPublishAttemptsForAllItemsByStatusAsync(OutboxItemStatus.Pending)
            .ConfigureAwait(false);

            await outboxTransaction.CommitAsync();
        }
        public static async Task <ISqlTransactionalOutboxProcessingResults <Guid> > ProcessPendingOutboxItemsAsync(
            this SqlTransaction sqlTransaction,
            ISqlTransactionalOutboxPublisher <Guid> outboxPublisher,
            OutboxProcessingOptions processingOptions,
            bool throwExceptionOnFailure = false
            )
        {
            sqlTransaction.AssertSqlTransactionIsValid();
            outboxPublisher.AssertNotNull(nameof(outboxPublisher));
            processingOptions.AssertNotNull(nameof(processingOptions));

            //NOTE: Payload type isn't important when Publishing because we publish the already serialized
            //      payload anyway so to simplify the custom extension signature we can just use string payload type here.
            var outboxProcessor = new DefaultSqlServerTransactionalOutboxProcessor <string>(sqlTransaction, outboxPublisher);

            var results = await outboxProcessor
                          .ProcessPendingOutboxItemsAsync(processingOptions, throwExceptionOnFailure)
                          .ConfigureAwait(false);

            return(results);
        }