added contact groups api and query logic