private void OnPayloadReceived(string payload)
 {
     if (payload != "0" && payload != "")
     {
         SetAccessTimeResponse rep = new SetAccessTimeResponse();
         rep.userId     = payload;
         rep.locationId = App.LOCATION_ID;
         RestService service = new RestService();
         VerifyAccess(payload);
     }
 }
        //Verify if user is permitted access before granting and writing an access time entry
        private async void VerifyAccess(string userId)
        {
            PermissionResponse rep = new PermissionResponse();

            rep.UserId = userId;

            RestService service = new RestService();

            LocationsResponse[] locations = await service.PostUserPermissions(rep);

            bool permissionFound = false;

            for (int i = 0; i < locations.Length; i++)
            {
                Console.WriteLine($"Location: {locations[i]}");
                if (locations[i].Location == App.LOCATION_ID.ToString())
                {
                    permissionFound = true;
                    break;
                }
            }

            if (permissionFound)
            {
                Device.BeginInvokeOnMainThread(async() => {
                    await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Success", "Successfully scanned", "OK");
                });

                SetAccessTimeResponse accessRep = new SetAccessTimeResponse();
                accessRep.userId     = userId;
                accessRep.locationId = App.LOCATION_ID;
                service.PostTimeRequest <SetAccessTimeResponse>(accessRep);
            }
            else
            {
                Device.BeginInvokeOnMainThread(async() => {
                    await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Permission Violation", "You are not permitted entry", "OK");
                });
            }
        }