private void balance(Node<T> currentNode) {
        int balanceFactor = getBalanceFactor(currentNode);
        if (balanceFactor > 1) {
            Node<T> leftChild = currentNode.getLeftChild();
            if (getBalanceFactor(leftChild) == -1) { // Left right case
                // reduce to left left case
                rotateLeft(leftChild, false);
            }
            // left left case
            if (currentNode.getParent() != null) {
                rotateRight(currentNode, true);
            } else {
                rotateRight(currentNode, false);
            }
        } else if (balanceFactor < -1) {
            Node<T> rightChild = currentNode.getRightChild();
            if (getBalanceFactor(rightChild) == 1) { // right left case
                // reduce to right right case
                rotateRight(rightChild, false);
            }
            //Right Right Case
            if (currentNode.getParent() != null) {
                rotateLeft(currentNode, true);
            } else {
                rotateLeft(currentNode, false);
            }
        }
    }