+ if ( $updates->{id} ){
+ $object = $self->find( $updates->{id}, { key => 'primary' } );
+ }
+ my @missing =
+ grep { !exists $updates->{$_} && !exists $fixed_fields{$_} } $self->result_source->primary_columns;
+ if ( !$object && !scalar @missing ) {
+# warn 'finding by: ' . Dumper( $updates ); use Data::Dumper;
+ $object = $self->find( $updates, { key => 'primary' } );
+ }
+ $updates = { %$updates, %$resolved };
+ @missing =
+ grep { !exists $resolved->{$_} } @missing;
+ if ( !$object && !scalar @missing ) {
+# warn 'finding by +resolved: ' . Dumper( $updates ); use Data::Dumper;
+ $object = $self->find( $updates, { key => 'primary' } );
+ }
+ $object ||= $self->new( {} );