public function setAt($offset, $data, $options = [])
    {
        $keys = is_array($offset) ? $offset : ($offset !== null ? explode('.', $offset) : []);

        $name = array_shift($keys);

        if ($keys) {
          $this->get($name)->setAt($keys, $data, $options);
        }

        if ($schema = $this->schema()) {
            $data = $schema->cast(null, $data, [
                'exists'    => isset($options['exists']) ? $options['exists'] : null,
                'parent'    => $this,
                'basePath'  => $this->basePath(),
                'defaults'  => true
            ]);
        }
        if ($name !== null) {
            if (!is_numeric($name)) {
                throw new ORMException("Invalid index `" . $name . "` for a collection, must be a numeric value.");
            }
            $previous = isset($this->_data[$name]) ? $this->_data[$name] : null;
            $this->_data[$name] = $data;
            if ($previous instanceof HasParentsInterface) {
                $previous->unsetParent($this);
            }
        } else {
            $this->_data[] = $data;
            $name = key($this->_data);
        }
        if ($data instanceof HasParentsInterface) {
            $data->setParent($this, $name);
        }
        $this->_modified = true;
        return $this;
    }