protected function downloadFile($dest, $callback = null)
    {
        $retval = [
            'success' => false,
            'data'    => [],
        ];

        if (is_resource($dest)) {
            $handle = $dest;
            $metadata = stream_get_meta_data($handle);
            $dest = $metadata["uri"];
        } else {
            $dest = rtrim($dest, '/');

            if (file_exists($dest)) {
                if (is_dir($dest)) {
                    $dest = rtrim($dest, '/') . "/{$this['name']}";
                } else {
                    $retval['data']['message'] = "File already exists at '$dest'.";
                    if (is_callable($callback)) {
                        call_user_func($callback, $retval, $dest);
                    }

                    return $retval;
                }
            }

            $handle = @fopen($dest, 'a');

            if (!$handle) {
                throw new \Exception("Unable to open file at '$dest'. Make sure the directory path exists.");
            }
        }

        $response = self::$httpClient->get(
            self::$account->getContentUrl() . "nodes/{$this['id']}/content",
            [
                'headers'    => [
                    'Authorization' => 'Bearer ' . self::$account->getToken()['access_token'],
                ],
                'stream'     => true,
                'exceptions' => false,
            ]
        );

        $retval['data'] = json_decode((string)$response->getBody(), true);

        if ($response->getStatusCode() !== 200) {
            if (is_callable($callback)) {
                call_user_func($callback, $retval, $dest);
            }

            return $retval;
        }

        $retval['success'] = true;

        $body = $response->getBody();
        while (!$body->eof()) {
            fwrite($handle, $body->read(1024));
        }

        fclose($handle);

        if (is_callable($callback)) {
            call_user_func($callback, $retval, $dest);
        }

        return $retval;
    }