public PagedInstalledApps GetAllInstalledApps(string locationId = null)
 {
     if (_allInstalledApps == null)
     {
         if (locationId != null)
         {
             _allInstalledApps = _installedAppsApi.ListInstallations(_accessToken, locationId);
         }
         else
         {
             _allInstalledApps = new PagedInstalledApps();
             var locations = GetAllLocations();
             if (locations?.Items != null)
             {
                 foreach (var location in locations.Items)
                 {
                     var locationApps = _installedAppsApi.ListInstallations(_accessToken, location.LocationId.ToString());
                     if (locationApps.Items?.Count > 0)
                     {
                         _allInstalledApps.Items ??= new List <InstalledApp>();
                         _allInstalledApps.Items.AddRange(locationApps.Items);
                     }
                 }
             }
         }
     }
     return(_allInstalledApps);
 }