unify and consolidate group fetching method for initial template fill and ajax request