private int CreateSolicitorModuleSet(string moduleSetName,string path)
        {
            var RoleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(db));

            //create new Module Configuration
            ModuleSet SolicitorModuleSet = new ModuleSet();
            SolicitorModuleSet.Name = moduleSetName;
            db.ModuleSet.Add(SolicitorModuleSet);
            db.SaveChanges();

            int SolicitorModuleSetID = db.ModuleSet.FirstOrDefault(p => string.Compare(p.Name, moduleSetName) == 0).ModuleSetID;
            // read file into a string and deserialize JSON to a type
            List<Module> configModules = JsonConvert.DeserializeObject<List<Module>>(System.IO.File.ReadAllText(@path));

            foreach (Module module in configModules)
            {
                if (module.Communication == Communication.BSolicitorToSSolicitor || module.Communication == Communication.SSolicitorToBSolicitor)
                {
                    module.ModuleSetID = SolicitorModuleSetID;
                    db.Module.Add(module);
                }
            }
            db.SaveChanges();
            return SolicitorModuleSetID;
        }
        private int CreateClientModules(string moduleSetName, Instruction instruction,int TemplateID)
        {
            var RoleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(db));

            //create new Module Configuration
            ModuleSet clientModuleSet = new ModuleSet();
            clientModuleSet.Name = moduleSetName;
            db.ModuleSet.Add(clientModuleSet);
            db.SaveChanges();

            int clientModuleSetID = db.ModuleSet.FirstOrDefault(p => string.Compare(p.Name, moduleSetName) == 0).ModuleSetID;

            // read file into a string and deserialize JSON to a type
            Template template = db.Template.Find(TemplateID);
            string path = template.Path;
            List<Module> configModules = JsonConvert.DeserializeObject<List<Module>>(System.IO.File.ReadAllText(@path));

            foreach (Module module in configModules)
            {
                if (module.Communication != Communication.BSolicitorToSSolicitor && module.Communication != Communication.SSolicitorToBSolicitor)
                {
                    module.ModuleSetID = clientModuleSetID;
                    db.Module.Add(module);
                }
            }
            db.SaveChanges();

            return clientModuleSetID;
        }