Hi,
When you are getting the submenus data for the first time from the database cache the data in the session object, and use the cached data when you need it for the next time. This would reduce the database interactions each time you click the menu to get the submenu.