private string AssignId() { var allIds = db.GetAllIds(); string newId; do { newId = GetRanomId(); } while (allIds.Contains(newId)); db.AddId(newId); return(newId); }