private Node insert(K key, E value, Node node) {
        if (node == null) {
            return new Node(key, value, 1);
        }
        int compareResult = node.key.compareTo(key);
        if (compareResult == 0) {
            node.value = value;
        } else if (compareResult > 0) {//new key is less than in current node
            node.left = insert(key, value, node.left);
        } else if (compareResult < 0) {
            node.right = insert(key, value, node.right);
        }
        node.size = size(node.left) + size(node.right) + 1;
        return node;
    }