Remove redundant from() causing errors on postgres
Do empty-PK detection before we try to obtain nextSequenceId, so it works properly also for the values considered empty
Properly remove previously created row with PK 0 to not fail on unique PK constrains