private TreeNode rotateRight(TreeNode rotatingNode) {

        TreeNode rotatedTreeRootNode = rotatingNode.left;
        rotatedTreeRootNode.parent = rotatingNode.parent;

        rotatingNode.left = rotatedTreeRootNode.right;

        if (rotatingNode.left != null) {
            rotatingNode.left.parent = rotatingNode;
        }

        rotatedTreeRootNode.right = rotatingNode;
        rotatingNode.parent = rotatedTreeRootNode;

        if (rotatedTreeRootNode.parent != null) {
            if (rotatedTreeRootNode.parent.right == rotatingNode) {
                rotatedTreeRootNode.parent.right = rotatedTreeRootNode;
            } else if (rotatedTreeRootNode.parent.left == rotatingNode) {
                rotatedTreeRootNode.parent.left = rotatedTreeRootNode;
            }
        }

        setBalance(rotatingNode);
        setBalance(rotatedTreeRootNode);

        return rotatedTreeRootNode;
    }