public static ParsedSanctions parse(Sanctions sanctions) {
    List<ParsedNamePart> names = new ArrayList<ParsedNamePart>();
    Map<String, String> partyIndexes = new HashMap<String, String>();
    final Sanctions.DistinctParties distinctParties = sanctions.getDistinctParties();
    final List<DistinctPartySchemaType> distinctParty = distinctParties.getDistinctParty();

    for (int i = 0; i < distinctParty.size(); i++) {
      DistinctPartySchemaType dp = distinctParty.get(i);
      final String profileId = dp.getFixedRef();
      partyIndexes.put(profileId, i + "");

      final List<DistinctPartySchemaType.Profile> profile = dp.getProfile();
      for (int j = 0; j < profile.size(); j++) {
        DistinctPartySchemaType.Profile p = profile.get(j);
        final List<IdentitySchemaType> identity = p.getIdentity();
        for (int k = 0; k < identity.size(); k++) {
          IdentitySchemaType idt = identity.get(k);
          final List<IdentitySchemaType.Alias> alias = idt.getAlias();
          for (int l = 0; l < alias.size(); l++) {
            IdentitySchemaType.Alias as = alias.get(l);
            final List<DocumentedNameSchemaType> documentedName = as.getDocumentedName();
            for (int m = 0; m < documentedName.size(); m++) {
              DocumentedNameSchemaType dnt = documentedName.get(m);
              final List<DocumentedNameSchemaType.DocumentedNamePart> dnp =
                  dnt.getDocumentedNamePart();
              for (int n = 0; n < dnp.size(); n++) {
                DocumentedNameSchemaType.DocumentedNamePart part = dnp.get(n);
                final DocumentedNameSchemaType.DocumentedNamePart.NamePartValue namePartValue =
                    part.getNamePartValue();
                final String value = namePartValue.getValue();
                final BigInteger namePartGroupID = namePartValue.getNamePartGroupID();
                final String aliasType = as.getAliasTypeID() + "";

                String nameType =
                    findNamePartTypeFromNameGroup(
                        idt.getNamePartGroups().getMasterNamePartGroup(), namePartGroupID);
                names.add(
                    new ParsedNamePart(
                        profileId, namePartGroupID + "", nameType, aliasType, value));
              }
            }
          }
        }
      }
    }

    Map<String, List<ParsedNamePart>> result = new HashMap<String, List<ParsedNamePart>>();
    for (int i = 0; i < names.size(); i++) {
      ParsedNamePart namePart = names.get(i);
      List<ParsedNamePart> parsedNameParts = result.get(namePart.getNameType());
      if (parsedNameParts == null) {
        parsedNameParts = new ArrayList<ParsedNamePart>();
        result.put(namePart.getNameType(), parsedNameParts);
      }
      parsedNameParts.add(namePart);
    }

    return new ParsedSanctions(result, partyIndexes);
  }