Hi @jorgecsilva - you need a new relation with 2 n:1. In case of tickets 1 to ticket and the second to contacts
After that you need a backend function to fill / remove the data. (backend function set_favorite). I create a variable called '_call' that could either be "1" or "2" and allowed frontend calls to it.
Last step ist to add 2 buttons into your form (Add / Remove) and assign a frontend function to each of them. Both frontend functions do only trigger the backend function you created before just with a different '_call' value.
Hope this will be helpful.