@SuppressWarnings({"rawtypes", "unchecked"})
  private static void recogniseCredentialType(@Nullable SdkAdditionalData additionalData, CredentialsType credentialsType) {
    if (!(additionalData instanceof RemoteSdkAdditionalData data)) return;
    if (data.getRemoteConnectionType() != CredentialsType.UNKNOWN) return;

    String credentialsId = data.connectionCredentials().getId();
    if (!credentialsType.hasPrefix(credentialsId)) return;

    Element root = new Element("root");
    data.connectionCredentials().save(root);

    Object credentials = credentialsType.createCredentials();
    try {
      credentialsType.getHandler(credentials).load(root);
    }
    catch (CannotLoadCredentialsException e) {
      Logger.getInstance(CredentialsManager.class).warn(e);
      return;
    }
    data.setCredentials(credentialsType.getCredentialsKey(), credentials);
  }
@SuppressWarnings({"rawtypes", "unchecked"})
  private static void recogniseCredentialType(@Nullable SdkAdditionalData additionalData, CredentialsType credentialsType)