Updated the functionality for dynamic menu building.

Updated the functionality for dynamic menu building in share view
layout.cshtml