Given a list of tasks and subtasks, how do you ensure all dependencies are resolved before execution?