public function offsetUnset($offset)
    {
        if (isset($this[$offset])) {
            if ($this->index_field === null) {
                $this->removed_objects[] = $this->objects[$offset];
                unset($this->objects[$offset]);

                // update iterator index
                if (
                    $this->current_index >= $offset &&
                    $this->current_index > 0
                ) {
                    $this->current_index--;
                }
            } else {
                $object = $this->objects_by_index[$offset];
                $this->removed_objects[] = $object;
                unset($this->objects_by_index[$offset]);

                $keys = array_keys($this->objects, $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);
        }
    }