docs: private void storeAndLinkMtoN(boolean onlyLink, Object obj, CollectionDescriptor cod,
                                    Object referencedObjects, boolean insert)
      {
          /*
          - if the collection is a collectionproxy and it's not already loaded
          no need to perform an update on the referenced objects
          - on insert we link and insert the referenced objects, because the proxy
          collection maybe "inherited" from the object before the PK was replaced
          */
          if(insert || !(referencedObjects instanceof CollectionProxy
                          && !((CollectionProxy) referencedObjects).isLoaded()))
          {
              // if referenced objects are null, assign empty list
              if(referencedObjects == null)
              {
                  referencedObjects = Collections.EMPTY_LIST;
              }
              /*
              NOTE: Take care of referenced objects, they could be of type Collection or
              an Array or of type ManageableCollection, thus it is not guaranteed that we
              can cast to Collection!!!
  
              if we store an object with m:n reference and no references could be
              found, we remove all entires of given object in indirection table
              */
              Iterator referencedObjectsIterator;
  
              if(!onlyLink && cod.getCascadingStore() == ObjectReferenceDescriptor.CASCADE_OBJECT)
              {
                  referencedObjectsIterator = BrokerHelper.getCollectionIterator(referencedObjects);
                  while (referencedObjectsIterator.hasNext())
                  {
                      store(referencedObjectsIterator.next());
                  }
              }
  
              Collection existingMtoNKeys;
              if(!insert)
              {
                  existingMtoNKeys = mtoNBroker.getMtoNImplementor(cod, obj);
                  // we can't reuse iterator
                  referencedObjectsIterator = BrokerHelper.getCollectionIterator(referencedObjects);
                  // remove all entries in indirection table which not be part of referenced objects
                  mtoNBroker.deleteMtoNImplementor(cod, obj, referencedObjectsIterator, existingMtoNKeys);
              }
              else
              {
                  existingMtoNKeys = Collections.EMPTY_LIST;
              }
              // we can't reuse iterator
              referencedObjectsIterator = BrokerHelper.getCollectionIterator(referencedObjects);
              while (referencedObjectsIterator.hasNext())
              {
                  Object refObj = referencedObjectsIterator.next();
                  // Now store indirection record
                  // BRJ: this could cause integrity problems because
                  // obj may not be stored depending on auto-update
                  mtoNBroker.storeMtoNImplementor(cod, obj, refObj, existingMtoNKeys);
              }
          }
      }