get the id of the last row properly in postgresql
use DAL method for after an insert.  trigger replacement that works across all supported DBs
add a few comments -- this should still be broken into small parts