public Task GetTask() { utils.Log(NLog.LogLevel.Debug, TaskName); Task task = null; TaskService ts = new TaskService(); TaskFolder tf = ts.GetFolder(TaskFolder); if (tf != null) { task = ts.GetFolder(TaskFolder).GetTasks().Where(a => a.Name.ToLower() == TaskName.ToLower()).FirstOrDefault(); } return(task); }