public virtual Schema Create(Repository repository, string schemaName, Stream templateStream) { Schema schema = new Schema(repository, schemaName); SchemaPath path = new SchemaPath(schema); if (path.Exists()) { throw new KoobooException("The item is already exists."); } GetLocker().EnterReadLock(); try { using (ZipFile zipFile = ZipFile.Read(templateStream)) { ExtractExistingFileAction action = ExtractExistingFileAction.OverwriteSilently; zipFile.ExtractAll(path.PhysicalPath, action); } Providers.DefaultProviderFactory.GetProvider <ISchemaProvider>().Initialize(schema); } finally { GetLocker().ExitReadLock(); } return(schema); }