public virtual async Task <List <ISqlTransactionalOutboxItem <TUniqueIdentifier> > > RetrieveOutboxItemsAsync(
            OutboxItemStatus status,
            int maxBatchSize = -1
            )
        {
            var statusParamName = OutboxTableConfig.StatusFieldName;
            var sql             = QueryBuilder.BuildSqlForRetrieveOutboxItemsByStatus(status, maxBatchSize, statusParamName);

            await using var sqlCmd = CreateSqlCommand(sql);
            AddParam(sqlCmd, statusParamName, status.ToString(), SqlDbType.VarChar);

            var results = new List <ISqlTransactionalOutboxItem <TUniqueIdentifier> >();

            await using var sqlReader = await sqlCmd.ExecuteReaderAsync().ConfigureAwait(false);

            while (await sqlReader.ReadAsync().ConfigureAwait(false))
            {
                var createdDateUtcFromDb = (DateTime)sqlReader[OutboxTableConfig.CreatedDateTimeUtcFieldName];

                var outboxItem = OutboxItemFactory.CreateExistingOutboxItem(
                    uniqueIdentifier: ConvertUniqueIdentifierFromDb(sqlReader),
                    status: sqlReader[OutboxTableConfig.StatusFieldName] as string,
                    fifoGroupingIdentifier: sqlReader[OutboxTableConfig.FifoGroupingIdentifier] as string,
                    publishAttempts: (int)sqlReader[OutboxTableConfig.PublishAttemptsFieldName],
                    createdDateTimeUtc: new DateTimeOffset(createdDateUtcFromDb, TimeSpan.Zero),
                    publishTarget: sqlReader[OutboxTableConfig.PublishTargetFieldName] as string,
                    serializedPayload: sqlReader[OutboxTableConfig.PayloadFieldName] as string
                    );

                results.Add(outboxItem);
            }

            return(results);
        }
        public virtual async Task IncrementPublishAttemptsForAllItemsByStatusAsync(OutboxItemStatus status)
        {
            var statusParamName = OutboxTableConfig.StatusFieldName;
            var sql             = QueryBuilder.BuildSqlForBulkPublishAttemptsIncrementByStatus(statusParamName);

            await using var sqlCmd = CreateSqlCommand(sql);
            AddParam(sqlCmd, statusParamName, status.ToString(), SqlDbType.VarChar);

            await sqlCmd.ExecuteNonQueryAsync().ConfigureAwait(false);
        }