protected function updateActiveParents(array $parents)
    {
        $modelInfo       = $this->getModelInformation();
        $modelClass      = $modelInfo->modelClass();
        $model           = new $modelClass;
        $previousContext = null;
        $previousParent  = array_shift($parents);
        $separator       = $this->getListParentSeparator();

        // Store top level parent as active
        if ( ! $previousParent || is_string($previousParent) && false === strpos($previousParent, $separator)) {
            $this->listParentRelation  = $previousParent === false ? false : null;
            $this->listParentRecordKey = null;
        } else {
            list($this->listParentRelation, $this->listParentRecordKey) = explode($separator, $previousParent, 2);
        }

        $count = 0;

        // Add 'end' marker to force overwriting a previously longer chain link as a terminator
        $parents[] = null;

        // Loop through further parents, where $parent is what $previousParent refers back to
        foreach ($parents as $parent) {

            $count++;

            // If we have no interpretable parent to use as sub-context, stop
            if ( ! $previousParent || is_string($previousParent) && false === strpos($previousParent, $separator)) {
                break;
            }

            // If we have no interpretable parent as target, clear the context, and stop
            if ( ! $parent || is_string($parent) && false === strpos($parent, $separator)) {
                $this->setListParentDataInMemory(null, null, $previousParent, $previousContext);
                break;
            }

            list($relation, $key) = explode($separator, $parent, 2);

            // Set new parent at this level
            $this->setListParentDataInMemory($relation, $key, $previousParent, $previousContext);

            // If this is the last parent, then there is no need to prepare for the next iteration
            if ($count == count($parents)) {
                break;
            }

            // If the context (model) changed, determine the new context and remember it for the next iteration
            $listParentInfo = $this->getListParentInformation($model, $relation, $key, $modelInfo);

            if ( ! count($listParentInfo)) {
                break;
            }

            // Check and update the model class (for the memory context) if necessary.
            // This is only relevant for list parent reference across models.
            $listParentInfo = head($listParentInfo);
            /** @var ListParentData $listParentInfo */

            if ($modelClass !== get_class($listParentInfo->model)) {
                $model           = $listParentInfo->model;
                $modelClass      = get_class($model);
                $previousContext = $this->getModelSessionKey($this->getModuleHelper()->modelSlug($model));
            }

            $previousParent = $parent;
        }
    }