bool MovingEntitiesOperator::preRecursion(const OctreeElementPointer& element) {
    EntityTreeElementPointer entityTreeElement = std::static_pointer_cast<EntityTreeElement>(element);
    
    // In Pre-recursion, we're generally deciding whether or not we want to recurse this
    // path of the tree. For this operation, we want to recurse the branch of the tree if
    // any of the following are true:
    //   * We have not yet found the old entity, and this branch contains our old entity
    //   * We have not yet found the new entity, and this branch contains our new entity
    //
    // Note: it's often the case that the branch in question contains both the old entity
    // and the new entity.
    
    bool keepSearching = (_foundOldCount < _lookingCount) || (_foundNewCount < _lookingCount);

    // If we haven't yet found all the entities, and this sub tree contains at least one of our
    // entities, then we need to keep searching.
    if (keepSearching && shouldRecurseSubTree(element)) {

        // check against each of our search entities
        int detailIndex = 0;
        foreach(const EntityToMoveDetails& details, _entitiesToMove) {
        
            if (_wantDebug) {
                qCDebug(entities) << "MovingEntitiesOperator::preRecursion() details["<< detailIndex <<"]-----------------------------";
                qCDebug(entities) << "    entityTreeElement:" << entityTreeElement->getAACube();
                qCDebug(entities) << "    entityTreeElement->bestFitBounds(details.newCube):" << entityTreeElement->bestFitBounds(details.newCube);
                qCDebug(entities) << "    details.entity:" << details.entity->getEntityItemID();
                qCDebug(entities) << "    details.oldContainingElementCube:" << details.oldContainingElementCube;
                qCDebug(entities) << "    entityTreeElement:" << entityTreeElement.get();
                qCDebug(entities) << "    details.newCube:" << details.newCube;
                qCDebug(entities) << "    details.newCubeClamped:" << details.newCubeClamped;
                qCDebug(entities) << "    _lookingCount:" << _lookingCount;
                qCDebug(entities) << "    _foundOldCount:" << _foundOldCount;
                qCDebug(entities) << "--------------------------------------------------------------------------";
            }
        

            // If this is one of the old elements we're looking for, then ask it to remove the old entity
            if (!details.oldFound && entityTreeElement == details.oldContainingElement) {
                // DO NOT remove the entity here.  It will be removed when added to the destination element.
                _foundOldCount++;
                //details.oldFound = true; // TODO: would be nice to add this optimization
                if (_wantDebug) {
                    qCDebug(entities) << "MovingEntitiesOperator::preRecursion() -----------------------------";
                    qCDebug(entities) << "    FOUND OLD - REMOVING";
                    qCDebug(entities) << "    entityTreeElement == details.oldContainingElement";
                    qCDebug(entities) << "--------------------------------------------------------------------------";
                }
            }

            // If this element is the best fit for the new bounds of this entity then add the entity to the element
            if (!details.newFound && entityTreeElement->bestFitBounds(details.newCube)) {
                // remove from the old before adding
                EntityTreeElementPointer oldElement = details.entity->getElement();
                if (oldElement != entityTreeElement) {
                    if (oldElement) {
                        oldElement->removeEntityItem(details.entity);
                    }
                    entityTreeElement->addEntityItem(details.entity);
                } else {
                    entityTreeElement->bumpChangedContent();
                }
                _foundNewCount++;
                //details.newFound = true; // TODO: would be nice to add this optimization
                if (_wantDebug) {
                    qCDebug(entities) << "MovingEntitiesOperator::preRecursion() -----------------------------";
                    qCDebug(entities) << "    FOUND NEW - ADDING";
                    qCDebug(entities) << "    entityTreeElement->bestFitBounds(details.newCube)";
                    qCDebug(entities) << "--------------------------------------------------------------------------";
                }
            }
            detailIndex++;
        }
        // if we haven't found all of our search for entities, then keep looking
        keepSearching = (_foundOldCount < _lookingCount) || (_foundNewCount < _lookingCount);
    }