public static <E> FunctionExecutor<E> createPoll(final FeatureDefinition<? extends Property<? extends Queue<E>>> propertyDefinition) {

        return new FunctionExecutor<E>() {

            @Override
            public E invoke(FunctionInvocation<E> invocation, Object... arguments) throws ExecutorInvocationException {

                invocation.next(arguments);

                E element = invocation.getHolder().get(propertyDefinition).get().poll();

                // Set the parent of the removed (polled) element to null
                if (element != null && element instanceof ChildFeatureHolder) {
                    ((ChildFeatureHolder<?>) element).setParent(null);
                }

                return element;
            }

        };
    }