public function update(StorePage $request, Page $id): RedirectResponse 	{ 		$page = $id;  		$page->update([ 			'name' => $request->name, 			'description' => $request->description, 			'active' => $request->boolean('active'), 			'main_page' => $request->boolean('main_page'), 			'market_id' => getCurrentMarket()->id, 		]);  		$page->storage()->handle();  		// get all ids from $request->old_content 		$oldContentIds = [];  		foreach ($request->content ?? [] as $data) { 			$oldContentIds[] = $data['id'] ?? null; 		} 		$currentContentIds = $page->content->pluck('id')->toArray();  		// delete all ids that are not in $request->old_content 		$idsToDelete = array_diff($currentContentIds, $oldContentIds); 		$page->content()->whereIn('id', $idsToDelete)->delete(); 		$page->refresh();  		foreach ($request->content ?? [] as $data) { 			$currentContent = $page->content()->updateOrCreate(['id' => $data['id'] ?? null], [ 				'content' => $data, 				'order_number' => $data['order_number'], 				'type' => $data['type'], 			]);  			if ($data['type'] == DynamicContent::Tabs->value) { 				$contentWithMedia = $currentContent->content['tabs'];  				foreach ($data['tabs'] ?? [] as $key => $tab) { 					$customMediaConfig = $currentContent->createMediaConfigWithTabIndex($key); 					$currentContent->storage()->handleCloneFromNestedArray($tab, $request->media, $customMediaConfig);  					$contentWithMedia[$key]['media'] = $currentContent->media()->where('custom_properties->tab_index', $key)->first()?->getKey() ?? null; 					$currentContent->update([ 						'content' => [ 							'tabs' => $contentWithMedia, 							'type' => $data['type'], 							'order_by' => $data['order_number'], 						], 					]); 				} 			} else { 				$currentContent->storage()->handleCloneFromNestedArray($data, $request->media); 			} 		}  		return $this->redirectFromSave('pages.list'); 	}