This whole thing seems like it could be refactored:

```ruby
if autosave
  if record.marked_for_destruction?
    record.destroy
  else
    key = reflection.options[:primary_key] ? send(reflection.options[:primary_key]) : id

    if record.new_record? || record[reflection.foreign_key] != key || record.changed_for_autosave?
      record[reflection.foreign_key] = key unless reflection.through_reflection
      record[reflection.foreign_key] = key unless reflection.through_reflection

      saved = record.save(:validate => !autosave)
      raise ActiveRecord::Rollback if !saved && autosave
      saved
    end
  end
end
```

What do you think? Anything I missed?