code: protected void cleanCollectionForSave(final RESTBaseEntityCollectionV1<?, ?, ?> collection,
              boolean cleanTopLevel) throws InvocationTargetException,
              IllegalAccessException {
          if (collection == null) return;
  
          if (cleanTopLevel) {
              collection.removeInvalidChangeItemRequests();
          }
  
          for (final RESTBaseEntityV1<?> item : collection.returnItems()) {
              cleanEntityForSave(item);
          }
      }
docs: Cleans a collection and it's entities to remove any items in the collection that don't need to be sent to the server.
  
  @param collection The collection to be cleaned.
  @throws InvocationTargetException
  @throws IllegalAccessException