Rewrite and correct searchByGroup query.
Rewrite and correct getImages and getGroups.