//internal for testing
        internal SmartActionWorker CreateWorker(Controller ctrl, Func <dynamic> modelId, ICustomAttributeProvider action, IDependencyResolver solver)
        {
            if (ctrl == null)
            {
                throw new NotSupportedException("This attribute works only with Controller");
            }

            var ipFactory = solver.GetService <IValidationFailedPolicyFactory>();

            if (ipFactory == null)
            {
                ipFactory = new ValidationFailedPolicyActivator(solver);
            }

            var facade = new SmartContextFacade(ctrl, modelId, ValidationFailedPolicy ?? DefaultPolicy, ipFactory);


            CheckOverridePolicy(action, facade);
            var worker = new SmartActionWorker(facade);

            return(worker);
        }
        //internal for testing 
        internal SmartActionWorker CreateWorker(Controller ctrl,Func<dynamic> modelId, ICustomAttributeProvider action,IDependencyResolver solver)
        {
            if (ctrl == null) throw new NotSupportedException("This attribute works only with Controller");

            var ipFactory = solver.GetService<IValidationFailedPolicyFactory>();
            if (ipFactory == null)
            {
                ipFactory=new ValidationFailedPolicyActivator(solver);
            }
            
            var facade = new SmartContextFacade(ctrl,modelId,ValidationFailedPolicy??DefaultPolicy, ipFactory);
            
            
            CheckOverridePolicy(action,facade);
            var worker = new SmartActionWorker(facade);
            return worker;
        }