public int removeNode(XMLTreeNode node, File bitmapFile){
        if(node.isFileNode()){
            // Remove a file 
            int numOfBlocks = Integer.parseInt(node.getNode().getAttributes().item(0).toString().split("\"")[1]);
            int fileNumber = Integer.parseInt(node.getNode().getAttributes().item(3).toString().split("\"")[1]);
            for (int j = 0; j < numOfBlocks; j++) {
                final String blockName = "D" + Integer.toString(fileNumber * 1024 + j);

                new Thread(new Runnable() {

                    @Override
                    public void run() {

                        String blockId = "";
                        do {
                            try {
                                blockId = ClientUtilities.findBlockId(client, blockName);
                            } catch (Exception ex) {
                                Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                                return;
                            }
                        } while (blockId.equals(""));
                        try {
                            client.getFilesManager().deleteFile(blockId, new BoxDefaultRequestObject());
                        } catch (Exception ex) {
                            Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                            return;
                        }
                    }
                }).run();
            }
            // Unset bit
            try {
                Bitmap.unsetBit(bitmapFile, fileNumber);
            } catch (IOException e) {
                e.printStackTrace();
            }
            Node parent = node.getNode().getParentNode();
            parent.removeChild(node.getNode());
            // Save document
            try {
                XMLFileReader.saveXML(doc, indexFile);
            } catch (TransformerException e) {
                e.printStackTrace();
            }
            refreshBrowser();;  
            return 1;
        }else{
            // Remove a folder
            if(node.getNode().getChildNodes().getLength() == 0){
                Node parent = node.getNode().getParentNode();
                parent.removeChild(node.getNode());
                // Save document
                try {
                    XMLFileReader.saveXML(doc, indexFile);
                } catch (TransformerException e) {
                    e.printStackTrace();
                }
                refreshBrowser();
                return 1;
            }else{
                return -1;
            }
            
        }
    }