public Result <BonusResult, ErrorCode> ExecuteBonus(int level, BonusEntity bonus, RequestContext <BonusArgs> requestContext)
        {
            var bns = bonus.Data.FromByteArray <Bonus>();

            if (bns is BullRushFreeSpinBonus fb)
            {
                return(BullRushFreeSpinFeature.Execute(level, requestContext, fb, bonus));
            }
            else if (bns is BullRushJackpotBonus jpb)
            {
                return(BullRushJackPotFeature.Execute(level, requestContext, jpb, bonus));
            }

            return(ErrorCode.NonexistenceBonus);
        }
        public Result <Bonus, ErrorCode> CreateBonus(SpinResult spinResult)
        {
            var   result = spinResult as BullRushSpinResult;
            Bonus bonus;

            try
            {
                if (result.IsRacing)
                {
                    bonus = BullRushFreeSpinFeature.CreateBonus(result);
                }
                else if (result.IsInnerWheelBonus)
                {
                    bonus = BullRushJackPotFeature.CreateBonus(result);
                }
                else
                {
                    return(ErrorCode.NonexistenceBonus);
                }

                result.BonusElement = new BullRushBonusElement {
                    Id = bonus.Id, Value = bonus.Guid.ToString("N")
                };

                result.Bonus = new BonusStruct()
                {
                    Id = bonus.Id,
                };
            }
            catch (Exception ex)
            {
                logger.LogError("[Determine Freespin Bonus]: Create bonus position wrongly");
                logger.LogError(ex, ex.Message);
                return(ErrorCode.NonexistenceBonus);
            }

            return(bonus);
        }