protected ExternalPermissionOwner convert(final IPermissionOwner permissionOwner) {
    if (permissionOwner == null) {
      return null;
    }

    final ExternalPermissionOwner externalPermissionOwner = new ExternalPermissionOwner();

    externalPermissionOwner.setName(permissionOwner.getName());
    externalPermissionOwner.setFname(permissionOwner.getFname());
    externalPermissionOwner.setDesc(permissionOwner.getDescription());

    final List<ExternalActivity> externalActivities = externalPermissionOwner.getActivities();

    final Set<IPermissionActivity> activities = permissionOwner.getActivities();
    for (final IPermissionActivity permissionActivity : activities) {
      final ExternalActivity externalActivity = new ExternalActivity();
      externalActivity.setName(permissionActivity.getName());
      externalActivity.setFname(permissionActivity.getFname());
      externalActivity.setDesc(permissionActivity.getDescription());
      externalActivity.setTargetProvider(permissionActivity.getTargetProviderKey());

      externalActivities.add(externalActivity);
    }
    Collections.sort(externalActivities, ExternalActivityFnameComparator.INSTANCE);

    return externalPermissionOwner;
  }
  /* (non-Javadoc)
   * @see org.jasig.portal.io.xml.IDataImporter#importData(java.lang.Object)
   */
  @Override
  @Transactional
  public void importData(ExternalPermissionOwner externalPermissionOwner) {
    final String name = externalPermissionOwner.getName();
    final String fname = externalPermissionOwner.getFname();
    final IPermissionOwner permissionOwner =
        this.permissionOwnerDao.getOrCreatePermissionOwner(name, fname);

    final String desc = externalPermissionOwner.getDesc();
    permissionOwner.setDescription(desc);

    for (final ExternalActivity externalActivity : externalPermissionOwner.getActivities()) {
      final String activityName = externalActivity.getName();
      final String activityFname = externalActivity.getFname();
      final String targetProvider = externalActivity.getTargetProvider();

      final IPermissionActivity permissionActivity =
          this.permissionOwnerDao.getOrCreatePermissionActivity(
              permissionOwner, activityName, activityFname, targetProvider);

      final String activityDesc = externalActivity.getDesc();
      permissionActivity.setDescription(activityDesc);
    }

    this.permissionOwnerDao.saveOwner(permissionOwner);
  }