Save relational data from array

Hi, there!
I’m having a lot of trouble to figure this out so I thought I could ask for some help.
In a project, one of the tables have a list of Movies and one of the columns is a relationship 1:N with a “Genre” table. This Genre table have only the objectId and the genre name.
I’m retrieving some data from a external source but every movie can have more than one genre connected to. So for this genre data, I’m receiving a array with every genre name (not the objectId), like this one:

["Biography", "Drama"]

So, my question is what is the fastest/easiest way to insert the relation at the Movies table. Any help?
Thanks in advance!
Regards,
Tiago Schmidt

Hi Tiago,

For every item in the array, you can create an instance of the Genre class. Your Movie class would have a collection of the created Genre objects. Saving the Movie object with the API will create the relationships between Movie and the genres

Mark