@Override
public void moveUsers(UserGroup fromGroup, UserGroup toGroup) {
try {
List<User> users = userLocalService.getUserGroupUsers(fromGroup.getUserGroupId());
long[] userIds = toIdArray(users.toArray(new User[]{}));
userLocalService.addUserGroupUsers(toGroup.getUserGroupId(), userIds);
userLocalService.unsetUserGroupUsers(fromGroup.getUserGroupId(), userIds);
} catch (Exception e) {
String msg = String.format("Failed to users from [%s] to [%s]", fromGroup.getName(),
toGroup.getName());
log(msg, e);
throw new RuntimeException(msg, e);
}
}