public void Add(Database database, string tableName) { if (database is null) { throw new ArgumentNullException(nameof(database)); } if (tableName is null) { throw new ArgumentNullException(nameof(tableName)); } if (!_tableValidator.IsValidName(tableName: tableName)) { throw new ArgumentException($"Invalid table name {tableName}."); } if (!_tableValidator.IsUniqueName(database: database, tableName: tableName)) { throw new ArgumentException($"The table {tableName} is already exists in the database {database.Name}."); } Table table = new Table(name: tableName) { DatabaseId = database.Id }; _tableRepository.Add(entity: table); _attributeService.AddPrimaryKey(table: table, primaryKeyName: "Id"); }