private async Task CreateBuyers(EnvironmentSeed seed, string token)
        {
            var defaultBuyer = SeedConstants.DefaultBuyer();

            seed.Buyers.Add(defaultBuyer);
            foreach (var buyer in seed.Buyers)
            {
                var superBuyer = new SuperHSBuyer()
                {
                    Buyer  = buyer,
                    Markup = new BuyerMarkup()
                    {
                        Percent = 0
                    }
                };

                var exists = await BuyerExistsAsync(buyer.Name, token);

                if (exists == null || exists.Count == 0)
                {
                    var createdBuyer = await _buyerCommand.Create(superBuyer, token, _oc);

                    if (createdBuyer.Buyer.Name == defaultBuyer.Name && seed.AnonymousShoppingBuyerID == null)
                    {
                        seed.AnonymousShoppingBuyerID = createdBuyer.Buyer.ID;
                    }
                }
                else
                {
                    seed.AnonymousShoppingBuyerID = exists.FirstOrDefault().ID;
                }
            }
        }
        private async Task CreateConfigureAnonBuyer(EnvironmentSeed seed, string token)
        {
            var anonBuyer    = SeedConstants.AnonymousBuyerUser();
            var defaultBuyer = SeedConstants.DefaultBuyer();

            //create anonymous buyer user
            var createUser = _oc.Users.SaveAsync(seed.AnonymousShoppingBuyerID, anonBuyer.ID, anonBuyer, token);

            //create and assign initial buyer location
            var createBuyerLocation = _buyerLocationCommand.Save(seed.AnonymousShoppingBuyerID,
                                                                 $"{seed.AnonymousShoppingBuyerID}-{SeedConstants.DefaultLocationID}",
                                                                 SeedConstants.DefaultBuyerLocation(), token, true);

            var assignment = new UserGroupAssignment()
            {
                UserGroupID = $"{seed.AnonymousShoppingBuyerID}-{SeedConstants.DefaultLocationID}",
                UserID      = anonBuyer.ID
            };
            var saveAssignment = _oc.UserGroups.SaveUserAssignmentAsync(seed.AnonymousShoppingBuyerID, assignment, token);
            await Task.WhenAll(createUser, createBuyerLocation, saveAssignment);
        }
        private async Task CreateOnlyOnceBuyers(EnvironmentSeed seed, string token)
        {
            // create default buyer if it does not exist
            // default buyer will have a well-known ID we can use to query with
            var defaultBuyer = await GetBuyerByID(SeedConstants.DefaultBuyerID, token);

            if (defaultBuyer == null)
            {
                var superBuyer = new SuperHSBuyer()
                {
                    Buyer  = SeedConstants.DefaultBuyer(),
                    Markup = new BuyerMarkup()
                    {
                        Percent = 0
                    }
                };
                await _buyerCommand.Create(superBuyer, token, _oc);
            }

            // create seed buyers if they don't exist
            // seed buyers may not have ID defined, we are relying on Name instead
            foreach (var buyer in seed.Buyers)
            {
                var seedBuyer = await GetBuyerByName(buyer.Name, token);

                if (seedBuyer == null)
                {
                    var superBuyer = new SuperHSBuyer()
                    {
                        Buyer  = buyer,
                        Markup = new BuyerMarkup()
                        {
                            Percent = 0
                        }
                    };
                    await _buyerCommand.Create(superBuyer, token, _oc);
                }
            }
        }