Recursive Binary Search Tree Insert Function Using Generic Nodes

I am trying to code a function that adds a generic node to a binary search tree in the correct position. The node uses generic . I get a stack overflow error when adding a good amount of data to the BST and cannot understand why. I start the search with the root node every time. The code is somewhat complex because I wanted to have a parent pointer, but if this is much simpler without the parent pointer or there is a better way to implement that, please let me know. What error am I making in my recursion?

public Node(K k, V v) {         this.L = null;         this.R = null;         this.parent = null;         this.key = k;         this.value = v;     }  protected boolean insert(Node curNode, K key, V value) {         int result = key.compareTo(curNode.key);         if(result == 0){             return false;         }         else if(result < 0){             if(curNode.L != null)                 return insert(curNode.L, key, value);             else{                 Node toAdd = new Node(key, value);                 toAdd.parent = curNode;                 curNode.L = toAdd;                 return true;             }         }         else if(curNode.R != null)                 return insert(curNode.R, key, value);             else {                 Node toAdd = new Node(key, value);                 toAdd.parent = curNode;                 curNode.R = toAdd;                 return true;             }         }