protected void recursiveBalance(TreeNode currentNode) {

        setBalance(currentNode);
        int balance = currentNode.balance;

        if (balance == -2) {
            if (height(currentNode.left.left) >= height(currentNode.left.right)) {
                currentNode = rotateRight(currentNode);
            } else {
                currentNode = doubleRotateLeftRight(currentNode);
            }
        } else if (balance == 2) {
            if (height(currentNode.right.right) >= height(currentNode.right.left)) {
                currentNode = rotateLeft(currentNode);
            } else {
                currentNode = doubleRotateRightLeft(currentNode);
            }
        }

        if (currentNode.parent != null) {
            recursiveBalance(currentNode.parent);
        } else {
            this.root = currentNode;
        }
    }