public static function removeTags($tags) { if (empty($tags)) { return; } $res = Tag::findAll(['name' => $tags]); foreach ($res as $tag) { $tag->updateCounters(['frequency' => -1]); } Tag::deleteAll('frequency <= 0'); }