protected function applyContexts(ConditionPluginCollection &$conditions, array $provided = []) {
    foreach ($conditions as $condition) {
      if ($condition instanceof ContextAwarePluginInterface) {
        try {
          if (empty($provided)) {
            $contexts = $this->contextRepository->getRuntimeContexts(array_values($condition->getContextMapping()));
          }
          else {
            $contexts = $provided;
          }
          $this->contextHandler->applyContextMapping($condition, $contexts);
        }
        catch (ContextException $e) {
          return FALSE;
        }
      }
    }

    return TRUE;
  }