Adding trait and tests for the aggregate listener detach logic