Import of a Composite Data Entity with a new (self created) key

I have a header / lines scenario for which I created a Composite Data Entity.
I will get the same information multiple times, and each time I want to insert this data into my header/lines tables.

I create a number sequence, which should fetch a value for the header data during import.
The lines should of course reference the header by using that number sequence value.

Where can/should I insert the number sequence value?
If I could add it to the headerStaging table, I could reference it in linesEntity.mapEntityToDataSource and fetch that value. But I do not see the entry point for adding values during the insert into the headerStaging table.

I I add the value to the header table in headerEntity.mapEntityToDataSource, how can I fetch that value in linesEntity.mapEntityToDataSource?