public async Task <Subject[]> GetSubjectsAsync(string facultyId, string groupId)
        {
            var page = await _client.GetClassesPageAsync(facultyId, groupId);

            var classes = ClassParser.Parse(page, groupId);

            return(classes.GroupBy(x => x.Title)
                   .Select(x => {
                var subgroups = x.GroupBy(y => y.Subgroup).Select(y => y.First().Subgroup).ToArray();
                int?subgroupsCount = null;

                if (subgroups.Count() != 1)
                {
                    subgroupsCount = subgroups.Count();

                    if (subgroups.Contains(null))
                    {
                        subgroupsCount -= 1;
                    }
                }

                return new Subject
                {
                    Title = x.First().Title,
                    SubgroupsCount = subgroupsCount,
                    IsMandatory = x.First().IsMandatory
                };
            })
                   .OrderByDescending(x => x.IsMandatory)
                   .ThenBy(x => x.Title)
                   .ToArray());
        }
        public async Task <string> GetCalendarAsync(SubjectOptions[] options, string facultyId, string groupId)
        {
            var page = await _client.GetClassesPageAsync(facultyId, groupId);

            var classes = ClassParser.Parse(page, groupId);

            var calendarEvents = new List <CalendarEvent>();

            foreach (var c in classes)
            {
                if (!options.Any(x => x.Title == c.Title))
                {
                    continue;
                }

                if (c.Subgroup != null && !options.Where(x => x.Title == c.Title).Any(x => x.Subgroups.Contains((int)c.Subgroup)))
                {
                    continue;
                }

                calendarEvents.Add(new CalendarEvent
                {
                    End         = new CalDateTime(c.End, "Europe/Vilnius"),
                    Start       = new CalDateTime(c.Start, "Europe/Vilnius"),
                    Summary     = c.Title,
                    Location    = c.Location,
                    Description = $"{c.Teacher}\n{c.Type}{(c.Subgroup != null ? $"\nPogrupis {c.Subgroup}" : $"")}"
                });
            }

            var calendar = new Calendar();

            calendar.Events.AddRange(calendarEvents);

            var serializer = new CalendarSerializer();

            return(serializer.SerializeToString(calendar));
        }