using transaction to commit