public ActionResponseMessage AddModule(byte[] zip) { try { logger?.LogDebug("Adding new module DLLs from Zip."); var modules = PluginHelper.ExtractModulesFromZipData(zip, logger); if (modules != null) { AllModules.AddRange(modules); logger?.LogDebug("Modules added: " + string.Join(", ", modules.Select(m => m.Name))); db.Modules.AddRange(modules.Select(m => ModuleConfig.From(m, zip, true))); db.SaveChanges(); return(ActionResponseMessage.Success("Modules added: " + string.Join(", ", modules.Select(m => m.Name)))); } else { logger?.LogWarning("Modules failed to load."); return(ActionResponseMessage.Failure("Modules failed to load. Did you provide a zip file?")); } } catch (Exception e) { logger?.LogWarning("Modules failed to load."); return(ActionResponseMessage.Failure(e, "Modules failed to load. Did you provide a zip file?")); } }