public async Task <ActionResult> ModuleEdit_Partial(ModuleEditModel model) { if (model.ModuleGuid == Guid.Empty) { throw new InternalError("No moduleGuid provided"); } // we need to find the real type of the module for data binding ModuleDefinition origModule = await ModuleDefinition.LoadAsync(model.ModuleGuid); await ObjectSupport.HandlePropertyAsync <List <PageDefinition> >(nameof(ModuleDefinition.Pages), nameof(ModuleDefinition.__GetPagesAsync), origModule); ModuleDefinition mod = (ModuleDefinition) await GetObjectFromModelAsync(origModule.GetType(), nameof(model.Module)); if (!ModelState.IsValid) { return(PartialView(model)); } mod.CustomValidation(ModelState, "Module."); if (!ModelState.IsValid) { return(PartialView(model)); } model.Module = mod; await model.UpdateDataAsync(); Manager.CurrentModuleEdited = model.Module; ObjectSupport.CopyData(origModule, model.Module, ReadOnly: true); // update read only properties in model in case there is an error ObjectSupport.CopyDataFromOriginal(origModule, model.Module); // copy/save model.Module.Temporary = false; await model.Module.SaveAsync(); return(FormProcessed(model, this.__ResStr("okSaved", "Module settings saved"))); }