/// <summary>
 /// Get the list of  application entitlements for the user
 /// </summary>
 /// <param name="uid">User id</param>
 /// <returns>List of application entitlements for the user</returns>
 public IEnumerable <UserAppEntitlement> GetUserAppEntitlements(long uid)
 {
     try
     {
         var userAppEntitlements = _apiExecutor.Execute(_appEntitlementsApi.V1UserAppEntitlementListGetAsync, _authTokens.SessionToken, uid);
         if (userAppEntitlements == null)
         {
             return(null);
         }
         return(userAppEntitlements.Select(x => UserAppEntitlementFactory.Create(x)));
     }
     catch (Exception e)
     {
         _log?.LogError(0, e, "An error has occured while trying to update application entitlements");
         throw;
     }
 }
 /// <summary>
 /// Get the list of  application entitlements for the user
 /// </summary>
 /// <param name="uid">User id</param>
 /// <param name="appEntitlements"></param>
 /// <returns>List of updated application entitlements for the user</returns>
 public IEnumerable <UserAppEntitlement> UpdateUserAppEntitlements(long uid, IEnumerable <UserAppEntitlement> appEntitlements)
 {
     try
     {
         if (appEntitlements == null)
         {
             return(null);
         }
         var generatedUserAppEntitlements = appEntitlements.Select(x => CreateSymphonyUserAppEntitlement(x));
         var updatedAppEntitlements       = _apiExecutor.Execute(_appEntitlementsApi.V1UserAppEntitlementListPostAsync, _authTokens.SessionToken, uid, generatedUserAppEntitlements);
         if (updatedAppEntitlements == null)
         {
             return(null);
         }
         return(updatedAppEntitlements.Select(x => UserAppEntitlementFactory.Create(x)));
     }
     catch (Exception e)
     {
         _log?.LogError(0, e, "An error has occured while trying to update application entitlements");
         throw;
     }
 }