private Specification <AlarmSystem> GetAlarmSystemSpecification(AlarmSystemsQuery request)
 {
     return(new AlarmSystemByOwnerSpecification(request.OwnerId)
            .And(new AlarmSystemByInstallationStatusSpecification(request.Installed))
            .And(new AlarmSystemByArmStatusSpecification(request.Armed))
            .And(new AlarmSystemOnlyTriggeredSpecification(request.Triggered)));
 }
            protected async Task <int> GetTotalPages(
                AlarmSystemsQuery request,
                CancellationToken cancellationToken = default)
            {
                var alarmSystemSpecification = this.GetAlarmSystemSpecification(request);
                var totalAlarmSystems        = await this.alarmSystemQueryRepository.Total(alarmSystemSpecification, cancellationToken);

                return((int)Math.Ceiling((double)totalAlarmSystems / AlarmSystemsPerPage));
            }
            protected Task <IEnumerable <AlarmSystem> > GetAlarmSystemListing(
                AlarmSystemsQuery request,
                CancellationToken cancellationToken = default)
            {
                var alarmSystemSpecification = this.GetAlarmSystemSpecification(request);
                var skip = (request.Page - 1) * AlarmSystemsPerPage;

                return(this.alarmSystemQueryRepository.GetAlarmSystemListings(alarmSystemSpecification, skip, take: AlarmSystemsPerPage, cancellationToken));
            }