[SB-151][fix] extract method refactoring for getTopGroups and update javadoc