/// <summary> /// Create a new group. /// </summary> /// <param name="record">The group object.</param> /// <returns>The GroupId of the new group.</returns> public override Guid Create(Group record) { DataModel dataModel = new DataModel(); DataModelTransaction transaction = DataModelTransaction.Current; EntityPersistence entityPersistence = new EntityPersistence(); Guid entityId; TypeRow typeRow = DataModel.Type.TypeKeyExternalId0.Find("GROUP"); typeRow.AcquireReaderLock(transaction.TransactionId, DataModel.LockTimeout); try { record.TypeId = typeRow.TypeId; record.ImageId = typeRow.ImageId; } finally { typeRow.ReleaseReaderLock(transaction.TransactionId); } entityId = entityPersistence.Create(record); dataModel.CreateRightsHolder( entityId, record.TenantId.Value); dataModel.CreateGroup( entityId, GroupTypeMap.FromCode(record.GroupType), record.TenantId.Value); return(entityId); }