public void InsuranceBuy(Character character, IEnumerable <long> robotEids)
        {
            //auto clean
            InsuranceHelper.CleanUpInsurances();

            var currentInsurances = InsuranceHelper.CountInsurances(character);
            var maxInsurances     = RealMaxSlotsPerCharacter(character);
            var insuranceDays     = GetInsuranceDays(character);

            Corporation usedCorporation = null;

            foreach (var robot in robotEids.Select(RobotHelper.LoadRobotOrThrow))
            {
                try
                {
                    InsuranceBuy(character, robot, ref currentInsurances, maxInsurances, insuranceDays, ref usedCorporation);
                }
                catch (PerpetuumException gex)
                {
                    character.SendItemErrorMessage(Commands.ProductionInsuranceBuy, gex.error, robot);
                }
            }

            usedCorporation?.SendInsuranceList();
        }
        public ErrorCodes InsuranceDelete(Character character, long targetEid)
        {
            //auto clean
            InsuranceHelper.CleanUpInsurances();

            var item = Item.GetOrThrow(targetEid);

            var insurance = _insuranceHelper.GetInsurance(targetEid);

            if (insurance == null)
            {
                return(ErrorCodes.NoError);
            }

            if (insurance.corporationEid != null)
            {
                var corporation = character.GetCorporation();
                var role        = corporation.GetMemberRole(character);

                //ha nem az issuer akarja torolni
                if (insurance.character != character)
                {
                    //akkor torolhetio a CEO, dpCEO
                    if (!role.IsAnyRole(CorporationRole.DeputyCEO, CorporationRole.CEO, CorporationRole.Accountant))
                    {
                        return(ErrorCodes.InsufficientPrivileges);
                    }
                }
            }
            else
            {
                //le lehet torolni ha
                // - nalad van
                // - te kototted

                if (!((item.Owner == character.Eid) || (insurance.character == character)))
                {
                    return(ErrorCodes.AccessDenied);
                }
            }

            _insuranceHelper.DeleteAndInform(insurance, item.Eid);
            return(ErrorCodes.NoError);
        }