code: public static synchronized void setChannelGroups(Collection<WonderPushChannelGroup> channelGroups) {
          if (channelGroups == null) return;
          boolean save = false;
          try {
              Set<String> groupIdsToRemove = new HashSet<>(sChannelGroups.keySet());
              for (WonderPushChannelGroup channelGroup : channelGroups) {
                  if (channelGroup == null) continue;
                  groupIdsToRemove.remove(channelGroup.getId());
                  if (_putChannelGroup(channelGroup)) save = true;
              }
              for (String groupId : groupIdsToRemove) {
                  if (_removeChannelGroup(groupId)) save = true;
              }
          } catch (Exception ex) {
              Log.e(WonderPush.TAG, "Unexpected error while setting channel groups " + channelGroups, ex);
          } finally {
              try {
                  if (save) {
                      save();
                  }
              } catch (Exception ex) {
                  Log.e(WonderPush.TAG, "Unexpected error while setting channel groups " + channelGroups, ex);
              }
          }
      }
docs: Create, update and remove channel existing groups to match the given channel groups.
  
  <p>Creates, updates and removes channel groups both in this class registry and in Android.</p>
  
  <p>Any non listed, previously existing channel group will be removed.</p>
  
  @param channelGroups The channel groups to create or update.
  Any non listed, previously existing channel group will be removed.