public function toArray($plain = false)
    {
        $result = array();

        foreach ($this as $key => $value) {
            if ($plain) {
                $result[] = $value->toArray();
            } else {
                $result[] = $this->connection->unmarshall($value);
            }
        }

        return $result;
    }