Support multiple type of root view controllers for content action

updated the methodology to find the top view controller to support multiple types of root view controllers