/// <summary>
        /// Retrieve all filesystem nodes
        /// </summary>
        /// <returns>Flat representation of all the filesystem nodes</returns>
        /// <exception cref="NotSupportedException">Not logged in</exception>
        /// <exception cref="ApiException">Mega.co.nz service reports an error</exception>
        public IEnumerable <INode> GetNodes()
        {
            EnsureLoggedIn();

            GetNodesRequest  request  = new GetNodesRequest();
            GetNodesResponse response = Request <GetNodesResponse>(request, masterKey);

            Node[] nodes = response.Nodes;
            if (trashNode == null)
            {
                trashNode = nodes.First(n => n.Type == NodeType.Trash);
            }

            return(nodes.Distinct().OfType <INode>());
        }
        /// <summary>
        /// Retrieve list of nodes from a specified Uri
        /// </summary>
        /// <param name="uri">Uri</param>
        /// <exception cref="NotSupportedException">Not logged in</exception>
        /// <exception cref="ApiException">Mega.co.nz service reports an error</exception>
        /// <exception cref="ArgumentNullException">uri is null</exception>
        /// <exception cref="ArgumentException">Uri is not valid (id and key are required)</exception>
        public IEnumerable <INode> GetNodesFromLink(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            EnsureLoggedIn();

            string shareId;

            byte[] iv, metaMac, key;
            GetPartsFromUri(uri, out shareId, out iv, out metaMac, out key);

            // Retrieve attributes
            GetNodesRequest  getNodesRequest  = new GetNodesRequest(shareId);
            GetNodesResponse getNodesResponse = Request <GetNodesResponse>(getNodesRequest, key);

            return(getNodesResponse.Nodes.Select(x => new PublicNode(x, shareId)).OfType <INode>());
        }