Add new item with property of realation with another collection

I thought of this approach but let say restaurants and categories have many to many relationships the how do we update both respective fields in both the collections.
Ex. I have categories that may belong to many restaurants and I want to add a restaurant with 2 categories. The the restaurants ID in the respective category will also need updation. How can I achieve this? Is there any prebuilt functionalty in strapi.