fix: update already existing items
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index 3a5b06f..06ad222 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -119,6 +119,7 @@
 @frappe.whitelist()
 def publish_selected_items(items_to_publish):
 	items_to_publish = json.loads(items_to_publish)
+	items_to_update = []
 	if not len(items_to_publish):
 		frappe.throw(_('No items to publish'))
 
@@ -126,14 +127,24 @@
 		item_code = item.get('item_code')
 		frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
 
-		frappe.get_doc({
+		hub_dict = {
 			'doctype': 'Hub Tracked Item',
 			'item_code': item_code,
+			'published': 1,
 			'hub_category': item.get('hub_category'),
 			'image_list': item.get('image_list')
-		}).insert(ignore_if_duplicate=True)
+		}
+		if frappe.db.exists('Hub Tracked Item', item_code):
+			items_to_update.append(item)
+			hub_tracked_item = frappe.get_doc('Hub Tracked Item', item_code)
+			hub_tracked_item.update(hub_dict)
+			hub_tracked_items.save()
+		else:
+			frappe.get_doc(hub_dict).insert(ignore_if_duplicate=True)
 
-	items = map_fields(items_to_publish)
+	items_to_publish = list(filter(lambda x: x not in items_to_update, items_to_publish))
+	new_items = map_fields(items_to_publish)
+	existing_items = map_fields(items_to_update)
 
 	try:
 		item_sync_preprocess(len(items))
@@ -141,7 +152,8 @@
 
 		# TODO: Publish Progress
 		connection = get_hub_connection()
-		connection.insert_many(items)
+		connection.insert_many(new_items)
+		connection.bulk_update(existing_items)
 
 		item_sync_postprocess()
 	except Exception as e: