private Pair<Long, Recipients> handleCreatePushGroup(
      String groupName, byte[] avatar, Set<Recipient> members)
      throws InvalidNumberException, MmsException {
    GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this);
    byte[] groupId = groupDatabase.allocateGroupId();
    Set<String> memberE164Numbers = getE164Numbers(members);

    memberE164Numbers.add(TextSecurePreferences.getLocalNumber(this));

    groupDatabase.create(groupId, groupName, new LinkedList<String>(memberE164Numbers), null, null);
    groupDatabase.updateAvatar(groupId, avatar);

    return handlePushOperation(groupId, groupName, avatar, memberE164Numbers);
  }
  private Pair<Long, Recipients> handleUpdatePushGroup(
      byte[] groupId, String groupName, byte[] avatar, Set<Recipient> members)
      throws InvalidNumberException, MmsException {
    GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this);
    Set<String> memberE164Numbers = getE164Numbers(members);
    memberE164Numbers.add(TextSecurePreferences.getLocalNumber(this));

    for (String number : memberE164Numbers) Log.w(TAG, "Updating: " + number);

    groupDatabase.updateMembers(groupId, new LinkedList<String>(memberE164Numbers));
    groupDatabase.updateTitle(groupId, groupName);
    groupDatabase.updateAvatar(groupId, avatar);

    return handlePushOperation(groupId, groupName, avatar, memberE164Numbers);
  }
 @Override
 protected Void doInBackground(Void... voids) {
   final GroupDatabase db = DatabaseFactory.getGroupDatabase(GroupCreateActivity.this);
   final Recipients recipients = db.getGroupMembers(groupId, false);
   if (recipients != null) {
     final List<Recipient> recipientList = recipients.getRecipientsList();
     if (recipientList != null) {
       if (existingContacts == null) existingContacts = new HashSet<>(recipientList.size());
       existingContacts.addAll(recipientList);
     }
   }
   GroupDatabase.GroupRecord group = db.getGroup(groupId);
   if (group != null) {
     existingTitle = group.getTitle();
     final byte[] existingAvatar = group.getAvatar();
     if (existingAvatar != null) {
       existingAvatarBmp =
           BitmapFactory.decodeByteArray(existingAvatar, 0, existingAvatar.length);
     }
   }
   return null;
 }