refactoring code product image controller