/// <inheritdoc />
        public IEnumerable <ITaskRuntimeInfo> ReservePollingQueueTasks(string pollingQueueKey, int maxResults)
        {
            Trace.WriteLine("ENTER: Reserving {0} polling queue '{1}' tasks for execution ...".FormatInvariant(maxResults, pollingQueueKey));

            if (string.IsNullOrEmpty(pollingQueueKey))
            {
                throw new ArgumentNullException(nameof(pollingQueueKey));
            }

            if (maxResults < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxResults), maxResults, "Value must not be negative.");
            }

            string pollingQueueListKey = RedisTaskRuntimeInfoRepository.GetPollingQueueRedisKey(pollingQueueKey, TaskStatus.Pending);

            List <string> entityIds = new List <string>();

            using (IRedisPipeline pipeline = this.provider.CreatePipeline())
            {
                for (int i = 0; i < maxResults; i++)
                {
                    pipeline.PopFirstListElementAsText(pollingQueueListKey, value =>
                    {
                        if (!string.IsNullOrEmpty(value))
                        {
                            entityIds.Add(value);
                        }
                    });
                }

                pipeline.Flush();
            }

            ICollection <ITaskRuntimeInfo> result = this.GetAll(entityIds);

            Trace.WriteLine("EXIT: {0} polling queue '{1}' tasks reserved for execution.".FormatInvariant(result.Count, pollingQueueKey));

            return(result);
        }