private async void CheckGlobalTask(object state) { List <TaskSch> globalTasks = TasksBLL.GetGlobalTaskList("waiting"); if (globalTasks.Count == 0) { IsGlobalTaskRunning = false; } else { IsGlobalTaskRunning = true; var earlistStartTime = globalTasks.Min(task => task.Created); var earlistGlobalTasks = globalTasks.Where(task => task.Created == earlistStartTime); await ExecuteGlobalTasks(earlistGlobalTasks.ToList()); _globalTaskCheckTimer.Change(2000, Timeout.Infinite); } }