public async Task <Component> CreateAsync( string name, string?schemaSdl, IDictionary <string, object?>?values, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Value cannot be null or empty.", nameof(name)); } string?serializedValues = null; if (schemaSdl is not null) { ISchema schema = _schemaService.CreateSchema(schemaSdl); if (values is not null) { serializedValues = _schemaService.CreateValuesForSchema(schema, values); } } Component component = new(Guid.NewGuid(), name, schemaSdl, serializedValues, ComponentState.Active); CreateComponentChange log = new(component.Id, component.Version, component); using (var transaction = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { await _changeLogService.CreateAsync(log, cancellationToken); await _componentStore.AddAsync(component, cancellationToken); transaction.Complete(); } return(component); }