public function getElementsByMenuCodeAndStage(
        $menuCode,
        $stage
    ) {
        $elementsByMenuCode = isset($this->elementsStoredByMenuCode[$menuCode])
            ? $this->elementsStoredByMenuCode[$menuCode]
            : [];

        $elementsByStage = isset($this->elementsStoredByStage[$stage])
            ? $this->elementsStoredByStage[$stage]
            : [];

        $elements = array_values(
            array_intersect_key(
                array_merge(
                    $this->allElements,
                    $elementsByMenuCode
                ),
                $elementsByStage
            )
        );

        usort($elements, function ($element1, $element2) {
            $element1Id = spl_object_hash($element1);
            $element2Id = spl_object_hash($element2);

            return $this->priorities[$element1Id] <= $this->priorities[$element2Id];
        });

        return $elements;
    }