Replicated  lot of logic to add support for edit group.