     /// The identifier for the parent cells.
     let parentCellIdentifier = "ParentCell"
     
-    
     /// The identifier for the child cells.
     let childCellIdentifier = "ChildCell"
     
+    var dataSource: [Parent]!
     
     override func viewDidLoad() {
         super.viewDidLoad()

        self.tableView.deleteRowsAtIndexPaths(indexPaths, withRowAnimation: UITableViewRowAnimation.Fade)
        
        // update the total of rows
        self.total -= self.subItems[parent].count
    }
    
    /**
     Send the execution to collapse or expand the cell with parent and index specified.
     
     - parameter parent: The parent of the cell.
     - parameter index:  The index of the cell.
     */
    private func setExpandeOrCollapsedStateforCell(parent: Int, index: Int) {
        
        // if the cell is expanded
        if let value = self.currentItemsExpanded.indexOf(parent) {
            
            self.collapseSubItemsAtIndex(index)
            self.actualPositions[parent] = -1
            
            // remove the parent from the expanded list
            self.currentItemsExpanded.removeAtIndex(value)
            
            for i in parent + 1..<self.topItems.count {
                if self.actualPositions[i] != -1 {
                    self.actualPositions[i] -= self.subItems[parent].count
                }
            }
        }
        else {
            
            self.expandItemAtIndex(index)
            self.actualPositions[parent] = index
            
            for i in parent + 1..<self.topItems.count {
                if self.actualPositions[i] != -1 {
                    self.actualPositions[i] += self.subItems[parent].count
                }
            }
            
            // add the parent for the expanded list
            self.currentItemsExpanded.append(parent)
        }
    }
    
    /**
     Check if the cell at indexPath is a child or not.
     
     - parameter indexPath: The NSIndexPath for the cell
     
     - returns: True if it's a child cell, otherwise false.
     */
    private func isChildCell(indexPath: NSIndexPath) -> Bool {
        
        // find the parent cell of the cell with index specified.
        let parent = self.findParent(indexPath.row)
        
        // check if it's expanded or not
        let idx = self.currentItemsExpanded.indexOf(parent)
        
        return idx != nil && indexPath.row != self.actualPositions[parent]
    }
    
    /**
     Find the index of the parent cell for the index of a cell.
     
     - parameter index: The index of the cell to find the parent
     
     - returns: The index of parent cell.
     */
    private func findParent(index : Int) -> Int {
        
        var parent = 0
        var i = 0
        
        while (true) {
            
            if (i >= index) {
                return parent
            }
            
            // if it's expanded the cell
            if let _ = self.currentItemsExpanded.indexOf(parent) {
                
                // sum its childs and continue
                i += self.subItems[parent].count + 1
                
                if (i > index) {
                    return parent
                }
            }
            else {
                i += 1
            }
            parent += 1
        }
    }
}


        self.tableView.insertRowsAtIndexPaths(indexPaths, withRowAnimation: UITableViewRowAnimation.Fade)
        
        // update the total of rows
        self.total += currentSubItems.count
    }
    
    /**
