Genericized database insertion.