Updated insert with transactions.