private void CopyNode_R(AIONode dest, AIONode src)
        {
            if (src == null)
            {
                return;
            }
            //Copy
            if (src.data.isFile)
            {
                filesCount++;
                dest.Clone(src, GenerateFileID());
            }
            else
            {
                foldersCount++;
                dest.Clone(src, GenerateFolderID());
            }
            //Copy child
            if (src.childNode != null)
            {
                AIONode child = new AIONode();
                CopyNode_R(child, src.childNode);
                dest.childNode     = child;
                child.prevNode     = dest;
                child.prevIsParent = true;

                //Database
                //CopyInfo cho giong nhau giua 2 ID
                QueueNodeCopy(src.childNode.data.ID, child.data.ID);
            }

            if (src.nextNode != null)
            {
                AIONode next = new AIONode();
                CopyNode_R(next, src.nextNode);
                dest.nextNode     = next;
                next.prevNode     = dest;
                next.prevIsParent = false;

                //Database
                //CopyInfo cho giong nhau giua 2 ID
                QueueNodeCopy(src.nextNode.data.ID, next.data.ID);
            }
        }
        private void CopyNode_R(AIONode dest, AIONode src)
        {
            if (src == null) return;
            //Copy
            if (src.data.isFile) {
                filesCount++;
                dest.Clone(src, GenerateFileID());
            }
            else
            {
                foldersCount++;
                dest.Clone(src, GenerateFolderID());
            }
            //Copy child
            if (src.childNode != null)
            {
                AIONode child = new AIONode();
                CopyNode_R(child, src.childNode);
                dest.childNode = child;
                child.prevNode = dest;
                child.prevIsParent = true;

                //Database
                //CopyInfo cho giong nhau giua 2 ID
                QueueNodeCopy(src.childNode.data.ID, child.data.ID);
            }

            if (src.nextNode != null)
            {
                AIONode next = new AIONode();
                CopyNode_R(next, src.nextNode);
                dest.nextNode = next;
                next.prevNode = dest;
                next.prevIsParent = false;

                //Database
                //CopyInfo cho giong nhau giua 2 ID
                QueueNodeCopy(src.nextNode.data.ID, next.data.ID);
            }
        }
        //Return new AIONode
        public AIONode CopyNode(AIONode nodeToCopy, AIONode nodeToAttach)
        {
            if (nodeToAttach != null && nodeToAttach.data.isFile == false)             //Attach to folder
            {
                //AIONode newNode = new AIONode(nodeToCopy.info, nodeToCopy.isFile);
                //newNode.childNode = nodeToCopy.childNode;
                AIONode newNode = new AIONode();
                if (nodeToCopy.data.isFile)
                {
                    filesCount++;
                    newNode.Clone(nodeToCopy, GenerateFileID());

                    //Database
                    //CopyInfo cho giong nhau giua 2 ID
                    QueueNodeCopy(nodeToCopy.data.ID, newNode.data.ID);
                }
                else
                {
                    foldersCount++;
                    newNode.Clone(nodeToCopy, GenerateFolderID());
                }

                if (nodeToCopy.childNode != null)
                {
                    AIONode newChild = new AIONode();

                    //Copy child
                    CopyNode_R(newChild, nodeToCopy.childNode);

                    newNode.childNode = newChild;

                    //Gan lai parant cho newChild
                    //if (newChild != null)
                    //{
                    newChild.prevNode     = newNode;
                    newChild.prevIsParent = true;
                    //}

                    if (newChild.data.isFile)
                    {
                        //Database
                        //CopyInfo cho giong nhau giua 2 ID
                        QueueNodeCopy(nodeToCopy.childNode.data.ID, newChild.data.ID);
                    }
                }

                //----------------Check lai dong nay---------------------



                //Thay doi parent flag
                if (nodeToAttach.childNode != null)
                {
                    nodeToAttach.childNode.prevNode     = newNode;
                    nodeToAttach.childNode.prevIsParent = false;
                }

                newNode.nextNode       = nodeToAttach.childNode;
                newNode.prevNode       = nodeToAttach;
                newNode.prevIsParent   = true;
                nodeToAttach.childNode = newNode;

                //Execute Database Queue Command
                aioDb.ExecuteQueueCommand();

                return(newNode);
            }
            return(null);
        }
        //Return new AIONode
        public AIONode CopyNode(AIONode nodeToCopy, AIONode nodeToAttach)
        {
            if (nodeToAttach != null && nodeToAttach.data.isFile == false) //Attach to folder
            {
                //AIONode newNode = new AIONode(nodeToCopy.info, nodeToCopy.isFile);
                //newNode.childNode = nodeToCopy.childNode;
                AIONode newNode = new AIONode();
                if (nodeToCopy.data.isFile)
                {
                    filesCount++;
                    newNode.Clone(nodeToCopy, GenerateFileID());

                    //Database
                    //CopyInfo cho giong nhau giua 2 ID
                    QueueNodeCopy(nodeToCopy.data.ID, newNode.data.ID);
                }
                else
                {
                    foldersCount++;
                    newNode.Clone(nodeToCopy, GenerateFolderID());
                }

                if (nodeToCopy.childNode != null)
                {
                    AIONode newChild = new AIONode();

                    //Copy child
                    CopyNode_R(newChild, nodeToCopy.childNode);

                    newNode.childNode = newChild;

                    //Gan lai parant cho newChild
                    //if (newChild != null)
                    //{
                        newChild.prevNode = newNode;
                        newChild.prevIsParent = true;
                    //}

                    if (newChild.data.isFile)
                    {
                        //Database
                        //CopyInfo cho giong nhau giua 2 ID
                        QueueNodeCopy(nodeToCopy.childNode.data.ID, newChild.data.ID);
                    }
                }

                //----------------Check lai dong nay---------------------

                //Thay doi parent flag
                if (nodeToAttach.childNode != null)
                {
                    nodeToAttach.childNode.prevNode = newNode;
                    nodeToAttach.childNode.prevIsParent = false;
                }

                newNode.nextNode = nodeToAttach.childNode;
                newNode.prevNode = nodeToAttach;
                newNode.prevIsParent = true;
                nodeToAttach.childNode = newNode;

                //Execute Database Queue Command
                aioDb.ExecuteQueueCommand();

                return newNode;
            }
            return null;
        }