private function getMenuFromEvent(ResourceEventInterface $event)
    {
        $resource = $event->getResource();

        if (!$resource instanceof MenuInterface) {
            throw new InvalidArgumentException("Expected instance of MenuInterface");
        }

        return $resource;
    }