public function mapRule(PersistenceRule $rule): Rule
    {
        $ruleData = [
            'id' => $rule->id,
            'status' => $rule->status,
            'layout' => function () use ($rule): ?Layout {
                try {
                    // Layouts used by rule are always in published status
                    return $rule->layoutId !== null ? $this->layoutService->loadLayout($rule->layoutId) : null;
                } catch (NotFoundException $e) {
                    return null;
                }
            },
            'enabled' => $rule->enabled,
            'priority' => $rule->priority,
            'comment' => $rule->comment,
            'targets' => new LazyCollection(
                function () use ($rule): array {
                    return array_map(
                        function (PersistenceTarget $target): Target {
                            return $this->mapTarget($target);
                        },
                        $this->layoutResolverHandler->loadRuleTargets($rule)
                    );
                }
            ),
            'conditions' => new LazyCollection(
                function () use ($rule): array {
                    return array_map(
                        function (PersistenceCondition $condition): Condition {
                            return $this->mapCondition($condition);
                        },
                        $this->layoutResolverHandler->loadRuleConditions($rule)
                    );
                }
            ),
        ];

        return Rule::fromArray($ruleData);
    }