# File lib/dm-core/collection.rb, line 372
    def update!(attributes = {}, reload = false)
      # TODO: delegate to Model.update
      return true if attributes.empty?

      dirty_attributes = {}

      model.properties(repository.name).slice(*attributes.keys).each do |property|
        dirty_attributes[property] = attributes[property.name] if property
      end

      # this should never be done on update! even if collection is loaded. or?
      # each { |resource| resource.attributes = attributes } if loaded?

      changes = repository.update(dirty_attributes, scoped_query)

      # need to decide if this should be done in update!
      query.update(attributes)

      if identity_map.any? && reload
        reload_query = @key_properties.zip(identity_map.keys.transpose).to_hash
        model.all(reload_query.merge(attributes)).reload(:fields => attributes.keys)
      end

      # this should return true if there are any changes at all. as it skips validations
      # the only way it could be fewer changes is if some resources already was updated.
      # that should not return false? true = 'now all objects have these new values'
      return loaded? ? changes == size : changes > 0
    end