docs: private void collectModifications(NameAwareAttribute changedAttr,
  			List<ModificationItem> modificationList) throws NamingException {
  		NameAwareAttribute currentAttribute = originalAttrs.get(changedAttr.getID());
          if(currentAttribute != null && changedAttr.hasValuesAsNames()) {
              try {
                  currentAttribute.initValuesAsNames();
              } catch(IllegalArgumentException e) {
                  log.warn("Incompatible attributes; changed attribute has Name values but " +
                          "original cannot be converted to this");
              }
          }
  
  		if (changedAttr.equals(currentAttribute)) {
  			// No changes
  			return;
  		}
  		else if (currentAttribute != null && currentAttribute.size() == 1
  				&& changedAttr.size() == 1) {
  			// Replace single-vale attribute.
  			modificationList.add(new ModificationItem(
  					DirContext.REPLACE_ATTRIBUTE, changedAttr));
  		}
  		else if (changedAttr.size() == 0 && currentAttribute != null) {
  			// Attribute has been removed.
  			modificationList.add(new ModificationItem(
  					DirContext.REMOVE_ATTRIBUTE, changedAttr));
  		}
  		else if ((currentAttribute == null || currentAttribute.size() == 0)
  				&& changedAttr.size() > 0) {
  			// Attribute has been added.
  			modificationList.add(new ModificationItem(DirContext.ADD_ATTRIBUTE,
  					changedAttr));
  		}
  		else if (changedAttr.size() > 0 && changedAttr.isOrdered()) {
  			// This is a multivalue attribute and it is ordered - the original
  			// value should be replaced with the new values so that the ordering
  			// is preserved.
  			modificationList.add(new ModificationItem(
  					DirContext.REPLACE_ATTRIBUTE, changedAttr));
  		}
  		else if (changedAttr.size() > 0) {
  			// Change of multivalue Attribute. Collect additions and removals
  			// individually.
  			List<ModificationItem> myModifications = new LinkedList<ModificationItem>();
  			collectModifications(currentAttribute, changedAttr, myModifications);
  
  			if (myModifications.isEmpty()) {
  				// This means that the attributes are not equal, but the
  				// actual values are the same - thus the order must have
  				// changed. This should result in a REPLACE_ATTRIBUTE operation.
  				myModifications.add(new ModificationItem(
  						DirContext.REPLACE_ATTRIBUTE, changedAttr));
  			}
  
  			modificationList.addAll(myModifications);
  		}
  	}