/**
         *  this mothed checks if the inspectionround is over.
         */
        public async Task CheckEndControlAsync()
        {
            sLogger.CheckEndControl();
            if (DevicesToInspect.Count == 0)
            {
                Stop = DateTime.Now;
                await UserDialogs.Instance.AlertAsync("De Ronde is gedaan", null, "ok");

                var inspectionSummary = new InspectionSummaryRepresentationForCreation();
                inspectionSummary.OperatorId         = UserService.Operator.UserId;
                inspectionSummary.BackupOperatorId   = UserService.BackupOperator?.UserId;
                inspectionSummary.OrganisationUnitId = OrganisationUnitId;
                inspectionSummary.LocationId         = LocationId;
                inspectionSummary.DateStarted        = Start;
                inspectionSummary.DateFinished       = Stop;
                inspectionSummary.Completed          = true;
                inspectionSummary.TotalToInspect     = DevicesInspected.Count + DevicesToInspect.Count;
                inspectionSummary.TotalInspected     = DevicesInspected.Count;
                inspectionSummary.TotalApproved      = DevicesOk.Count;
                inspectionSummary.TotalDisApproved   = DevicesNotOk.Count;
                inspectionSummary.Remarks            = "";
                var config = new MapperConfiguration(cfg => { cfg.CreateMap <EquipmentReportItemModel, EquipmentReportItemRepresentation>(); });
                mapper = config.CreateMapper();
                inspectionSummary.ReportItems = mapper.Map <List <EquipmentReportItemRepresentation> >(ReportItems);
                inspectionSummary.ReportItems = mapper.Map <List <EquipmentReportItemRepresentation> >(ReportItems);
                var response = await Client.PostEnsureAsync("fire-safety/inspectionsummary", inspectionSummary);

                await NavigationService.RemovePage <IControlFormPage>();

                await NavigationService.PopAsync();

                sLogger.CheckEndControlCompleted();
            }
        }
        /**
         * If the user press the stop icon this method is called to safe a summery to the database
         */
        public async Task InspectionStopedAsync()
        {
            try
            {
                Stop = DateTime.Now;
                var TotalInspected   = DevicesInspected.Count();
                var TotalApproved    = DevicesOk.Count();
                var TotalDisApproved = DevicesNotOk.Count();
                var remark           = await UserDialogs.Instance.PromptAsync("", "", "stoppen", null, "reden van afsluiten");

                sLogger.ControlRoundHasStopped(remark.Text);
                if (remark.Ok)
                {
                    var inspectionSummary = new InspectionSummaryRepresentationForCreation();
                    inspectionSummary.OperatorId         = UserService.Operator.UserId;
                    inspectionSummary.BackupOperatorId   = UserService.BackupOperator?.UserId;
                    inspectionSummary.OrganisationUnitId = OrganisationUnitId;
                    inspectionSummary.LocationId         = LocationId;
                    inspectionSummary.DateStarted        = Start;
                    inspectionSummary.DateFinished       = Stop;
                    inspectionSummary.Completed          = false;
                    inspectionSummary.TotalToInspect     = DevicesInspected.Count + DevicesToInspect.Count;
                    inspectionSummary.TotalInspected     = DevicesInspected.Count;
                    inspectionSummary.TotalApproved      = DevicesOk.Count;
                    inspectionSummary.TotalDisApproved   = DevicesNotOk.Count;
                    inspectionSummary.Remarks            = remark.Text;
                    var config = new MapperConfiguration(cfg => { cfg.CreateMap <EquipmentReportItemModel, EquipmentReportItemRepresentation>(); });
                    mapper = config.CreateMapper();
                    inspectionSummary.ReportItems = mapper.Map <List <EquipmentReportItemRepresentation> >(ReportItems);
                    inspectionSummary.PLG_Mail    = UserService.Operator.PLG_Mail;
                    var response = await Client.PostEnsureAsync("fire-safety/inspectionsummary", inspectionSummary);

                    DependencyService.Get <IApplicationService>().CloseApplication();
                }
            }catch (Exception e)
            {
                sLogger.SendStopSummeryFailed(e);
            }
        }