public async Task Acknowledge(QueuedMessage queuedMessage)
        {
            if (!(queuedMessage is DbQueuedMessage dbQueuedMessage))
            {
                throw new InvalidOperationException("A DbQueuedMessage is expected.");
            }

            var entity = await DbSet.FindAsync(dbQueuedMessage.Id);

            if (_removeProduced)
            {
                DbSet.Remove(entity);
            }
            else
            {
                entity.Produced = DateTime.UtcNow;
            }

            await DbContext.SaveChangesAsync();
        }
 public Task Retry(QueuedMessage queuedMessage)
 {
     // Nothing to do, the message is retried if not marked as produced
     return(Task.CompletedTask);
 }