private function iterateBlocks(\Closure $function)
	{
		$return = array();

		foreach ($this->pageRequest->getBlockSet() as $index => $block) {
			/* @var $block Block */

			$blockId = $block->getId();
			/* @var $blockController BlockController */

			if ( ! isset($this->blockControllers[$blockId])) {
				$this->blockControllers[$blockId] = null;
			}

			$blockController = &$this->blockControllers[$blockId];

			$return[$index] = $function($block, $blockController);

			// NB! Block controller variable might be rewritten in the function
			if ($blockController instanceof BlockController
					&& $blockController->hadException()) {

				$this->container->getLogger()->error(sprintf(
						'Block controller throwed an exception [%s].',
						$blockController->getException()->getMessage()
				));
				
				// Don't cache failed blocks
				unset($this->blockCacheRequests[$blockId]);
			}
		}

		return $return;
	}