public function dump($return = false, $print = true, $depth = 1)
    {
        $dump = $this->data();
        $links = $this->links;

        foreach ($links as $key => $link) {
            if ($depth < 1) {
                try {
                    $related = $this->{$key};
                } catch (ServerException $e) {
                    $related = array('$error' => $e->getMessage());
                }

                if ($related instanceof Resource) {
                    $dump[$key] = $related->dump(true, false, $depth+1);
                } else {
                    $dump[$key] = $related;
                }
            }
        }
        if ($links) {
            $dump['$links'] = $this->dump_links($links);
        }

        return $print ? print_r($dump, $return) : $dump;
    }