/// <summary>
        /// Get HierachySync data.
        /// </summary>
        /// <param name="serverId">server id.</param>
        /// <param name="hsync">Content sync object</param>
        /// <param name="stateIndex">Start index.</param>
        /// <returns>The AbstractFastTransferStream</returns>
        private AbstractFastTransferStream GetAbstractHierachySync(
            int serverId,
            HierarchySync hsync,
            int stateIndex)
        {
            AbstractFastTransferStream afts = new AbstractFastTransferStream();
            AbstractHierarchySync ahsync = new AbstractHierarchySync();
            afts.StreamType = FastTransferStreamType.hierarchySync;

            ahsync.FinalICSState = this.GetAbstractState(serverId, stateIndex, hsync.State);
            ahsync.AbstractDeletion = this.GetAbstractDeletion(hsync.Deletions);
            AbstractFolderChange fc = new AbstractFolderChange();

            // Get the FolderchangeInfo, FolderCount and IsParentFolderBeforeChild
            // of the AbstractHierarchySync.
            if (hsync.FolderChangeList != null && hsync.FolderChangeList.Count > 0)
            {
                AbstractFolderChange tmp = new AbstractFolderChange();

                // fields:IsPidTagFolderIdExist,IsPidTagParentFolderIdExist
                // IsPidTagParentSourceKeyValueZero,IsPidTagSourceKeyValueZero
                // need all folderChange's corresponding flag is true.
                fc = hsync.FolderChangeList[0].GetAbstractFolderChange();
                for (int i = 1; i < hsync.FolderChangeList.Count; i++)
                {
                    tmp = hsync.FolderChangeList[i].GetAbstractFolderChange();
                    fc.IsPidTagFolderIdExist =
                        fc.IsPidTagFolderIdExist && tmp.IsPidTagFolderIdExist;
                    fc.IsPidTagParentFolderIdExist =
                        fc.IsPidTagParentFolderIdExist && tmp.IsPidTagParentFolderIdExist;
                    fc.IsPidTagParentSourceKeyValueZero =
                        fc.IsPidTagParentSourceKeyValueZero && tmp.IsPidTagParentSourceKeyValueZero;
                    fc.IsPidTagSourceKeyValueZero =
                        fc.IsPidTagSourceKeyValueZero && tmp.IsPidTagSourceKeyValueZero;
                }

                ahsync.FolderchangeInfo = fc;

                // The count of folderChange.
                ahsync.FolderCount = hsync.FolderChangeList.Count;

                // If parents are before their children,
                // for a specific folder change, its ParentSourceKey
                // must be zero if its parent is the sync folder
                // or can be found before the position of the folder change.
                ahsync.IsParentFolderBeforeChild = hsync.IsParentBeforeChildren;
            }

            afts.AbstractHierarchySync = ahsync;
            return afts;
        }