protected function addMembers(array $members, array $managers, GroupInterface $entity) {
    foreach ($members as $account_uuid) {
      $account = $this->userStorage->loadByProperties([
        'uuid' => $account_uuid,
      ]);

      if (($account = current($account)) && !$entity->getMember($account)) {
        $values = [];
        // If the user should have the manager role, grant it to him now.
        if (in_array($account_uuid, $managers)) {
          $values = ['group_roles' => [$entity->bundle() . '-group_manager']];
        }
        $entity->addMember($account, $values);
      }
    }
  }