I have a primary link menu and sub menu. I have created it through drupal configurations. But somehow sub menu needs to be dynamic based on contents. I have an array of menu and sub menu with title and path, this array is dynamic with time to time. I want to write a code which will delete the previously available sub menus and add the new sub menu.
So basically question is how can I delete the available primary link sub menu from code and add new sub menu?