private void applyAssociationOperation(
     Association association,
     AssociationKey key,
     AssociationOperation operation,
     AssociationContext associationContext) {
   switch (operation.getType()) {
     case CLEAR:
       removeAssociation(key, associationContext);
       break;
     case PUT:
       putAssociationOperation(
           association,
           key,
           operation,
           associationContext.getAssociationTypeContext().getAssociatedEntityKeyMetadata());
       break;
     case REMOVE:
       removeAssociationOperation(
           association,
           key,
           operation,
           associationContext.getAssociationTypeContext().getAssociatedEntityKeyMetadata());
       break;
   }
 }
  @Override
  public void insertOrUpdateAssociation(
      AssociationKey key, Association association, AssociationContext associationContext) {
    Map<SerializableRowKey, Map<String, Object>> associationRows =
        ((SerializableMapAssociationSnapshot) association.getSnapshot()).getUnderlyingMap();

    for (AssociationOperation action : association.getOperations()) {
      switch (action.getType()) {
        case CLEAR:
          associationRows.clear();
        case PUT:
          associationRows.put(
              new SerializableRowKey(action.getKey()),
              MapHelpers.associationRowToMap(action.getValue()));
          break;
        case REMOVE:
          associationRows.remove(new SerializableRowKey(action.getKey()));
          break;
      }
    }

    final Cache<AK> associationCache = getCacheManager().getAssociationCache(key.getMetadata());
    associationCache.put(
        new Element(getKeyProvider().getAssociationCacheKey(key), associationRows));
  }