private IEnumerable <AggregationResult> RunTicketTypesGroupingQuery(IHqlQuery query, AggregateMethods aggregation, string state)
        {
            var queryResult = CRMHelper.RunGroupByQuery(transactionManager.Value, query, aggregation, "TicketPartRecord.TicketType", state, "ticket");

            var ticketTypes = this.basicDataService.GetTicketTypes();

            List <AggregationResult> returnValue = new List <AggregationResult>();

            foreach (var item in queryResult)
            {
                var ticketType = item.Key != null?ticketTypes.FirstOrDefault(c => c.Id == item.Key.Value) : null;

                string label = ticketType == null?T("[No Ticket Type]").Text : ticketType.Name;

                AggregationResult aggregationResult = new AggregationResult
                {
                    AggregationValue = item.Value,
                    Label            = label,
                    GroupingField    = item.Key
                };

                returnValue.Add(aggregationResult);
            }

            return(returnValue);
        }