/// <summary>
        /// Refreshes the queue and sets the execution timer to the first available tasks.
        /// </summary>
        /// <param name="state"></param>
        private async void RefreshQueue(object state)
        {
            await _service.RefreshTasksAsync();

            var result = await _service.CalculateTimespanAsync();

            if (result.Expiration != TimeSpan.Zero)
            {
                _executionTimer = new Timer(ExecuteTask, result.UpcomingTask, TimeSpan.Zero, result.Expiration);
            }
            else
            {
                _executionTimer?.Change(Timeout.Infinite, 0);
            }
        }