private void removeTvShow(TvShow tvShow){
synchronized (root) {
    TvShowTreeNode child=(TvShowTreeNode)nodeMap.get(tvShow);
    DefaultMutableTreeNode parent=root;
    if (child != null) {
      int index=getIndexOfChild(parent,child);
      nodeMap.remove(tvShow);
      for (      TvShowEpisode episode : new ArrayList<>(tvShow.getEpisodes())) {
        nodeMap.remove(episode);
        episode.removePropertyChangeListener(propertyChangeListener);
      }
      tvShow.removePropertyChangeListener(propertyChangeListener);
      child.removeAllChildren();
      child.removeFromParent();
      if (index > -1) {
        TreeModelEvent event=new TreeModelEvent(this,parent.getPath(),new int[]{index},new Object[]{child});
        for (        TreeModelListener listener : listeners) {
          try {
            listener.treeNodesRemoved(event);
          }
 catch (          NullPointerException|ArrayIndexOutOfBoundsException npe) {
          }
        }
      }
    }
  }
}

private void removeTvShow ( TvShow tvShow ) { synchronized ( root ) { TvShowTreeNode child = ( TvShowTreeNode ) nodeMap . get ( tvShow ) ; DefaultMutableTreeNode parent = root ; if ( child != null ) { int index = getIndexOfChild ( parent , child ) ; nodeMap . remove ( tvShow ) ; for ( TvShowEpisode episode : new ArrayList < > ( tvShow . getEpisodes ( ) ) ) { nodeMap . remove ( episode ) ; episode . removePropertyChangeListener ( propertyChangeListener ) ; } tvShow . removePropertyChangeListener ( propertyChangeListener ) ; child . removeAllChildren ( ) ; child . removeFromParent ( ) ; if ( index > - 1 ) { TreeModelEvent event = new TreeModelEvent ( this , parent . getPath ( ) , new int [ ] { index } , new Object [ ] { child } ) ; for ( TreeModelListener listener : listeners ) { try { listener . treeNodesRemoved ( event ) ; } catch ( NullPointerException | ArrayIndexOutOfBoundsException npe ) { } } } } } }
removes the tv show .
