Reworking database inserts