protected function _processAssociation(Event $event, EntityInterface $entity, Association $assoc, array $settings)
    {
        $foreignKeys = (array)$assoc->getForeignKey();
        $primaryKeys = (array)$assoc->getBindingKey();
        $countConditions = $entity->extract($foreignKeys);
        $updateConditions = array_combine($primaryKeys, $countConditions);
        $countOriginalConditions = $entity->extractOriginalChanged($foreignKeys);

        if ($countOriginalConditions !== []) {
            $updateOriginalConditions = array_combine($primaryKeys, $countOriginalConditions);
        }

        foreach ($settings as $field => $config) {
            if (is_int($field)) {
                $field = $config;
                $config = [];
            }

            if (isset($this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field]) &&
                $this->_ignoreDirty[$assoc->getTarget()->getRegistryAlias()][$field] === true
            ) {
                continue;
            }

            if (is_callable($config)) {
                if (is_string($config)) {
                    throw new RuntimeException('You must not use a string as callable.');
                }
                $count = $config($event, $entity, $this->_table, false);
            } else {
                $count = $this->_getCount($config, $countConditions);
            }
            if ($count !== false) {
                $assoc->getTarget()->updateAll([$field => $count], $updateConditions);
            }

            if (isset($updateOriginalConditions)) {
                if (is_callable($config)) {
                    if (is_string($config)) {
                        throw new RuntimeException('You must not use a string as callable.');
                    }
                    $count = $config($event, $entity, $this->_table, true);
                } else {
                    $count = $this->_getCount($config, $countOriginalConditions);
                }
                if ($count !== false) {
                    $assoc->getTarget()->updateAll([$field => $count], $updateOriginalConditions);
                }
            }
        }
    }