protected void SaveCriteriaButtonClick(object sender, EventArgs e)
        {
            var values = _entityUi.UiProperties.ToDictionary(uiProperty => uiProperty.PropertyName, uiProperty => uiProperty.Value);

            TheWorkflowInstantiationCriteriaService.SetConfigurationProperties(_instantiationCriteria.Id, values);
            TheEventService.RegisterEvents();
        }
        public ActionResult Save(int id, FormCollection formCollection)
        {
            var instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(id);
            var ui = TheWorkflowEntityUiResolver.Resolve(instantiationCriteria);

            var values = new Dictionary <string, object>();

            foreach (var prop in ui.UiProperties)
            {
                values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl,
                                                                           formCollection[prop.PropertyName]);
            }

            TheWorkflowInstantiationCriteriaService.SetConfigurationProperties(id, values);
            TheEventService.RegisterEvents();

            return(RedirectToAction("Index"));
        }