public function actionCleanupImageTable()
    {
        $rows = Yii::$app->db->createCommand('SELECT file_id, filter_id, COUNT(*) as count FROM {{%admin_storage_image}} GROUP BY file_id, filter_id HAVING COUNT(*) > 1')->queryAll();
        
        if (empty($rows)) {
            return $this->outputInfo("no dublications has been detected.");
        }
        
        $this->outputInfo("dublicated image files detected:");
        foreach ($rows as $row) {
            $this->output("> file {$row['file_id']} with filter {$row['filter_id']} found {$row['count']} duplicates.");
        }

        if ($this->confirm("Do you want to delte the duplicated files in the image storage table?")) {
            foreach ($rows as $key => $row) {
                // get the lowest entrie
                $keep = Yii::$app->db->createCommand('SELECT id FROM {{%admin_storage_image}} WHERE file_id=:fileId AND filter_id=:filterId ORDER BY id LIMIT 1', [
                    ':fileId' => $row['file_id'],
                    ':filterId' => $row['filter_id'],
                ])->queryOne();
            
                if (!$keep) {
                    $this->outputError('Unable to find the first row for this delete request. Skip this one');
                    continue;
                }
                
                $remove = Yii::$app->db->createCommand()->delete('{{%admin_storage_image}}', 'file_id=:fileId AND filter_id=:filterId AND id!=:id', [
                    ':fileId' => $row['file_id'],
                    ':filterId' => $row['filter_id'],
                    ':id' => $keep['id'],
                ])->execute();
                
                if ($remove) {
                    $this->outputSuccess("< Remove {$row['count']} duplications for file {$row['file_id']} with filter {$row['filter_id']}.");
                }
            }
        }
        
        return $this->outputSuccess("all duplications has been removed.");
    }