This is going to cause some trouble down the line. You usually never want to reassign identifiers in any case + this approach is "slow". I'd suggest the very same approach that most RDBMS use when assigning sequential identifiers by storing the last ID somewhere persistently (on a per-clan basis) and just incrementing it each time a new ID is needed. Hitting any tangible limits that way is incredibly unlikely + it's slightly faster + it's safer.
https://github.com/keyraven/ClanGen-CSharp/blob/f155ae5f56ee7b8cec15dd9b49b8d7d0bfccd882/Clangen/Models/CatGroups/Group.cs#L23C4-L45C1
This is going to cause some trouble down the line. You usually never want to reassign identifiers in any case + this approach is "slow". I'd suggest the very same approach that most RDBMS use when assigning sequential identifiers by storing the last ID somewhere persistently (on a per-clan basis) and just incrementing it each time a new ID is needed. Hitting any tangible limits that way is incredibly unlikely + it's slightly faster + it's safer.