private void excludeNonRelatedGroups(@NonNull final MeshNetwork network) {
        final List<Group> groups = new ArrayList<>();
        for (Group group : network.getGroups()) {
            for (ProvisionedMeshNode node : network.getNodes()) {
                if (isGroupInUse(node, group)) {
                    groups.add(group);
                }
            }
        }
        network.groups = groups;
    }
Excludes groups that are not related tot he list of nodes.

@param network Mesh network.
mesh/src/main/java/no/nordicsemi/android/mesh/ImportExportUtils.java