This TODO was added when we were still using moodledata folder for group images, it is not relevant any more because group images are in new file API which supports DB transaction rollbacks.
$transaction = $DB->start_delegated_transaction();
-// TODO: this is problematic because the DB rollback does not handle deleting of group images!
foreach ($params['groupids'] as $groupid) {
// validate params
$groupid = validate_param($groupid, PARAM_INTEGER);