Event before foreach