public void ExecuteCommands(IReadOnlyList <IStoreCommand> commands) { foreach (var command in commands) { switch (command) { case IEntityStoreCommand entityCmd: if (entityCmd.Entity is TenantEntity t) { _securityPolicy.FixupEntity(t); } break; } command.Execute(_dbContext); } _dbContext.SaveChanges(); }