public async Task <PersonLicensePrice> GetCompetititonTemporaryLicensePriceAsync(Competition competition, Gender gender, DateTime birthDate)
        {
            var expert = calculatorManager.Find(competition.Discipline);

            if (expert == null)
            {
                throw new InvalidDisciplineException();
            }

            var age = birthDate.Age();

            return(await LicensesWorkflow.GetPersonLicensePriceAsync(competition.LicenseIssuerId, competition.Discipline, gender, age, PersonLicenseFlags.TemporaryLicense));
        }
        public async Task <PersonLicensePrice> GetCompetitionLicenseRenewalPriceAsync(Competition competition, PersonLicense license)
        {
            if (!IsLicenseExpired(license, competition) && !license.Flags.HasFlag(PersonLicenseFlags.TemporaryLicense))
            {
                return(null);
            }

            var expert = calculatorManager.Find(competition.Discipline);

            if (expert == null)
            {
                throw new InvalidDisciplineException();
            }

            var age = license.Flags.HasFlag(PersonLicenseFlags.TemporaryLicense)
                ? license.Person.BirthDate.Age()
                : expert.SeasonAge(expert.Season(competition.Starts), license.Person.BirthDate);

            return(await LicensesWorkflow.GetPersonLicensePriceAsync(competition.LicenseIssuerId, competition.Discipline, license.Person.Gender, age, license.Flags));
        }