private void handleAttributeUpdates(Entity entity) {
    Entity existing = entityDefinitionDao.loadEntity(entity.getEntityVersionId());

    Map<Integer, EntityAttribute> newAttribById = new HashMap<Integer, EntityAttribute>();
    for (EntityAttribute attribute : entity.getAttributes()) {
      newAttribById.put(attribute.getEntityAttributeId(), attribute);
    }
    // Mark for deletion attributes that were removed
    for (EntityAttribute attrib : existing.getAttributes()) {
      if (newAttribById.get(attrib.getEntityAttributeId()) == null) {
        attrib.setDateVoided(entity.getDateChanged());
        attrib.setUserVoidedBy(Context.getUserContext().getUser());
        entity.addAttribute(attrib);
      }
    }
  }