UpSert in SQL is a command that update or insert rows, columns in a table.  
The conflict column, mostly the Primary Key will determine if it’s an update or insert, see SQL documentation for more details.

UpSert updates the blue tagged columns
UpSert updates the blue tagged columns

Our command is a little bit different because it acts on basis of the given Object.
If the example object Club is fully populated than also the Lists: Team and TeamPlayers of the object are processed (recursive as long the data is available).  

If theTeam and TeamPlayers has also some Lists which are populated than these will also updated or inserted, even the Many To Many relations.
In that case the Many to Many Reference Tables are also updated or inserted.
This function is done with the command:

WriteManyToManyRefTable(team)

If the reference FkColumn(s) (the column with the ForeignKey(s)) has no value the parent
Primary Key value will be used , so the link(s) stays intact, the new entires has by design auto numbering id,  see for the object designs the One To Many and Many To Many   And All To Many pages.


In the example the values in the blue rectangles are set by the UpSert command:

UpSert(club)

The object home club in this command, has of course many entries.

See for all the commands: SQLite-Doc