public static AgentTask AddTask(AgentTask newTask)
 {
     int newId = Tasks.Max(t => t.TaskID) + 1;
     newTask.TaskID = newId;
     Tasks.Add(newTask);
     return newTask;
 }
 public void UpdateTask(int agentId, int taskId, AgentTask updatedTask)
 {
     Agent agent = Database.Agents.SingleOrDefault(a => a.AgentID == agentId);
     AgentTask task = agent.Tasks.Where(t => t.TaskID == taskId).SingleOrDefault();
     // Update the task from the database
     task.Description = updatedTask.Description;
     task.IsComplete = updatedTask.IsComplete;
 }
 public AgentTask AddTask(int agentId, AgentTask newTask)
 {
     Agent agent = Database.Agents.SingleOrDefault(a => a.AgentID == agentId);
     // Create the task and attach it to the agent entity
     newTask = Database.AddTask(newTask);
     agent.Tasks.Add(newTask);
     return newTask;
 }