Change action checking to be done in memory instead going to DB and do a...

...nd aggregation query.