Use the set and save methods to write data to a table in a data source using an ORM entity class.
Insert
The following example will insert a new record into the Categories table with a CategoryName of Custom Category. This will automatically be an INSERT operation as the primary key field on the table CategoryId was not supplied.
The save method will return an array of new primary key values for inserted records.
Update
After the line of code above is executed, the keys array will contain the CategoryId for the newly added record.
The example below updates the CatgoryName field for this new record to My Categoryby including the key field CatagoryID in the update with the key value.