public static Props Props <TIn, TOut>(ActorMaterializer materializer, StageModule <TIn, TOut> op, Attributes parentAttributes, out object materialized)
        {
            var attr = parentAttributes.And(op.Attributes);
            // USE THIS TO AVOID CLOSING OVER THE MATERIALIZER BELOW
            // Also, otherwise the attributes will not affect the settings properly!
            var   settings = materializer.EffectiveSettings(attr);
            Props result;

            materialized = null;

            if (op is IGroupBy)
            {
                var groupBy = (IGroupBy)op;
                result = GroupByProcessorImpl <TIn> .Props(settings, groupBy.MaxSubstreams, groupBy.Extractor);
            }
            else if (op.GetType().IsGenericType&& op.GetType().GetGenericTypeDefinition() == typeof(DirectProcessor <,>))
            {
                throw new ArgumentException("DirectProcessor cannot end up in ActorProcessorFactory");
            }
            else
            {
                throw new ArgumentException($"StageModule type {op.GetType()} is not supported");
            }

            return(result);
        }