feat: Add executeInScope to handle the common enter-leave pattern