public function storeShownProductsOnMainPage(StoreShownProductsOnMainPage $request): RedirectResponse 	{ 		$currentMainPageProductIds = Product::mainPage()->pluck('id')->all();  		if ($request->products) { 			foreach ($request->products as $product) { 				// if already is on main page 				if (($key = array_search($product, $currentMainPageProductIds)) !== false) { 					unset($currentMainPageProductIds[$key]);  					continue; 				}  				Product::where('id', $product)->increment('sort_number'); 			} 		}  		Product::whereIn('id', $currentMainPageProductIds) 			->update([ 				'sort_number' => 0, 			]);  		return $this->redirectFromSave('products.create-shown-products-on-main-page'); 	}