Avoid using count function inside a for loop | CAST Appmarq