+=item find_or_insert
+
+Finds an existing, non-disabled tax jurisdiction matching the data_vendor
+and geocode fields. If there is one, updates its city, county, state, and
+country to match this record. If there is no existing record, inserts this
+record.
+
+=cut
+
+sub find_or_insert {
+ my $self = shift;
+ my $existing = $self->existing_search;
+ if ($existing) {
+ my $update = 0;
+ foreach (qw(city county state country)) {
+ if ($self->get($_) ne $existing->get($_)) {
+ $update++;
+ }
+ }
+ $self->set(taxratelocationnum => $existing->taxratelocationnum);
+ if ($update) {
+ return $self->replace($existing);
+ } else {
+ return;
+ }
+ } else {
+ return $self->insert;
+ }
+}
+
+sub existing_search {
+ my $self = shift;
+
+ my @unique = qw( data_vendor geocode );
+ push @unique, qw( state country )
+ if $self->data_vendor eq 'compliance_solutions';
+
+ qsearchs( 'tax_rate_location',
+ { disabled => '',
+ map { $_ => $self->$_ } @unique
+ }
+ );
+}
+