/// <inheritdoc />
 public IEnumerator <IModule> GetEnumerator()
 {
     foreach (var directory in Directory.GetDirectories(BasePath))
     {
         yield return(ModuleDtoFileSystem.ReadFromDirectory(directory).Unwrap().Result);
     }
 }
 /// <inheritdoc />
 public IModule GetModule(ModuleIdentity moduleIdentity)
 {
     if (!IsModuleRegistered(moduleIdentity))
     {
         return(null);
     }
     return(ModuleDtoFileSystem.ReadFromDirectory(Path.Combine(BasePath, moduleIdentity.ToString())).Unwrap().Result);
 }
        [MappedExceptionFilter(typeof(ArgumentException), HttpStatusCode.BadRequest)] // May be not safe
        public async Task InstallModulePackageAsync()
        {
            // TODO: use model bind
            string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            using (ZipArchive modulePackage = new ZipArchive(Request.Body))
            {
                modulePackage.ExtractToDirectory(tempPath);
            }
            var modules = new List <IModule>();

            foreach (var t in Directory.GetDirectories(tempPath))
            {
                modules.Add(await ModuleDtoFileSystem.ReadFromDirectory(t).Unwrap());
            }
            _modules.RegisterModules(modules);
        }