public function remove(SwatDBDataObject $remove_object)
    {
        if (in_array($remove_object, $this->objects, true)) {
            $this->removed_objects[] = $remove_object;

            if ($this->index_field !== null) {
                $index = $remove_object->{$this->index_field};
                unset($this->objects_by_index[$index]);
            }

            $keys = array_keys($this->objects, $remove_object, true);
            foreach ($keys as $key) {
                unset($this->objects[$key]);

                // update iterator index
                if ($this->current_index >= $key && $this->current_index > 0) {
                    $this->current_index--;
                }
            }

            // reindex ordinal array of records
            $this->objects = array_values($this->objects);
        }
    }