Make sure to return the next pending task in a group