'Check response from firebase in xamarin form app

I have a firebase data base and I do (CRUD) operation on it, so .. How can i check if there's a response or if there's data before Get it ? I retrive data but not check it .. How can I do it in try and catch ? Helper Class :

 public class Helper
    {
        public static async Task<TEntity> Get<TEntity>(string url)
        {
            HttpClientHandler clientHandler = new HttpClientHandler();
            clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };

            HttpClient client = new HttpClient(clientHandler);

            var response = await client.GetAsync(url);
            var json = await response.Content.ReadAsStringAsync();
            
            return JsonConvert.DeserializeObject<TEntity>(json);
        }
    }

And this ViewModel class :

public class PatientListPageModelView : BaseViewModel
    {
        private ObservableCollection<Patient> _Patient = new ObservableCollection<Patient>();

        public ObservableCollection<Patient> Patients { get => _Patient; set => SetProperty(ref _Patient, value, nameof(Patients)); }

        

        private ICommand _Appearing;
        private Patient _SelectedPatient;

        public ICommand Appearing { get => _Appearing; set => SetProperty(ref _Appearing, value, nameof(Appearing)); }


        public PatientListPageModelView()
        {

            Appearing = new AsyncCommand(async () => await LoadData());
        }

        async Task LoadData()
        {
            Patients = new ObservableCollection<Patient>((List<Patient>)await PatientService.GetUserPatients());

        }

        public Patient SelectedPatient
        {
            get => _SelectedPatient;
            set
            {
                if (value != null)
                {
                    App.Current.MainPage = new NavigationPage(new Views.TopBarProfile(value));
                }
                _SelectedPatient = value;
                OnPropertyChanged();
            }
        }
    }

So, where i can put check or handle this error ?

Edit : this is my Service to get the data :

public static async Task<IEnumerable<Patient>> GetUserPatients()
        {
            var url = await firebaseClient
                     .Child($"Specalists/406707265/Patients").BuildUrlAsync();

            var result = await Helper.Get<List<Patient>>(url);
            return result ;
        }


Solution 1:[1]

to check the HTTP response code

HttpClient client = new HttpClient(clientHandler);

var response = await client.GetAsync(url);

if (response.StatusCode == HttpStatusCode.OK)
{
  // 200
} 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jason