code: public void removeMenuItem(SubMenuItem parent, MenuItem item) {
          SubMenuItem subMenu = (parent != null) ? parent : ROOT;
  
          synchronized (subMenuItems) {
              ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu);
              if (subMenuChildren == null) {
                  throw new UnsupportedOperationException("Menu element not found");
              }
  
              subMenuChildren.remove(item);
              if (item.hasChildren()) {
                  subMenuItems.remove(item);
              }
          }
          menuStates.remove(item.getId());
      }
docs: Remove the menu item for the provided menu item in the provided sub menu.
  @param parent the submenu to search
  @param item the item to remove (Search By ID)