Add method to check whether a task is main task in its containing group