batch and forEachAsync implementation