EventHandler CheckIn()
        {
            return((sender, e) =>
            {
                var contaCell = ((UIButton)sender).Superview.Superview as FeedPDVCell;
                var path = collecFeedPdv.IndexPathForItemAtPoint(new CGPoint(contaCell.Frame.X, contaCell.Frame.Y));
                using (var cell = collecFeedPdv.CellForItem(path) as FeedPDVCell)
                {
                    var info = cell.GetPdvCardUiInfo();
                    var alert = UIAlertController.Create("CheckIn", "Gostaria de efetuar o Check-In em " + info.NomePDV +
                                                         "\n" + info.Endereco + " ? ", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancel) =>
                    {
                        MetricsManager.TrackEvent("CancelCheckIn");
                    }));

                    alert.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOK) =>
                    {
                        var isToOpenTarefas = false;
                        var index = feedCollection.Pdvs.FindIndex((obj) => obj.NomePDV.Equals(info.NomePDV) &&
                                                                  obj.Endereco.Equals(info.Endereco));

                        var gps = LocationHelper.UpdateLocation();
                        if (gps == null)
                        {
                            var alertGps = UIAlertController.Create("GPS Desativado",
                                                                    "Ligue o GPS ou tire do modo aviao para continuar utilizando o sistema", UIAlertControllerStyle.Alert);
                            alertGps.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (defaults) => { }));
                            alertGps.View.TintColor = UIColor.FromRGB(10, 88, 90);
                            PresentViewController(alertGps, true, null);
                        }
                        else
                        {
                            var cordenadaEsperada = controllerPCL.GetCoordinates(feedCollection.Pdvs[index].listTypePdv);
                            if (gps.Location == null)
                            {
                                var batery = ((int)(UIDevice.CurrentDevice.BatteryLevel * 100F));
                                controllerPCL.CheckIn(feedCollection.Pdvs[index].listTypePdv,
                                                      LocationHelper.LastLocation.Coordinate.Latitude,
                                                      LocationHelper.LastLocation.Coordinate.Longitude, batery);
                                isToOpenTarefas = true;
                            }
                            else
                            {
                                var gpsEsperado = new CLLocation(cordenadaEsperada[0], cordenadaEsperada[1]);
                                var distance = gpsEsperado.DistanceFrom(gps.Location);
                                if (distance > 500 &&
                                    (int)cordenadaEsperada[0] > 0 && (int)cordenadaEsperada[1] > 0)
                                {
                                    isToOpenTarefas = false;
                                    var alertRangePDV = UIAlertController.Create("PDV longe do esperado",
                                                                                 "Sua localizacao atual está diferente da esperada, tem certeza que gostaria de continuar ?"
                                                                                 , UIAlertControllerStyle.Alert);
                                    alertRangePDV.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancelRangePDV) =>
                                    {
                                        MetricsManager.TrackEvent("CancelCheckIn");
                                    }));

                                    alertRangePDV.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOKRangePDV) =>
                                    {
                                        var batery = ((int)(UIDevice.CurrentDevice.BatteryLevel * 100F));
                                        var gpsLocation = gps.Location.Coordinate;
                                        controllerPCL.RegistroDePontoEletronico();
                                        controllerPCL.CheckIn(feedCollection.Pdvs[index].listTypePdv,
                                                              gpsLocation.Latitude, gpsLocation.Longitude, batery);

                                        if (Storyboard.InstantiateViewController("TarefasController") is TarefasController tarefas)
                                        {
#if !DEBUG
                                            MetricsManager.TrackEvent("CheckInLoja");
#endif
                                            ShowViewController(tarefas, null);
                                        }
                                    }));
                                    alertRangePDV.View.TintColor = UIColor.FromRGB(10, 88, 90);
                                    PresentViewController(alertRangePDV, true, null);
                                }
                                else
                                {
                                    var batery = ((int)(UIDevice.CurrentDevice.BatteryLevel * 100F));
                                    isToOpenTarefas = true;
                                    var gpsLocation = gps.Location.Coordinate;
                                    controllerPCL.CheckIn(feedCollection.Pdvs[index].listTypePdv,
                                                          gpsLocation.Latitude, gpsLocation.Longitude, batery);
                                }
                            }
                            if (isToOpenTarefas)
                            {
                                controllerPCL.RegistroDePontoEletronico();
                                if (Storyboard.InstantiateViewController("TarefasController") is TarefasController tarefas)
                                {
#if !DEBUG
                                    MetricsManager.TrackEvent("CheckInLoja");
#endif
                                    ShowViewController(tarefas, null);
                                }
                            }
                        }
                    }));
                    alert.View.TintColor = UIColor.FromRGB(10, 88, 90);
                    PresentViewController(alert, true, null);
                }
            });
        }