private ServiceSearchItem[] GetServicesLookup(int associationRoleId) { TimeServiceClient timeService = null; ServiceSearchItem[] services = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; timeService = new TimeServiceClient(); ServiceSearchReturnValue serviceReturnValue = timeService.ServiceSearch(_logonSettings.LogonId, collectionRequest, associationRoleId); if (serviceReturnValue.Success) { if (serviceReturnValue.Service != null) { services = serviceReturnValue.Service.Rows; } } else { throw new Exception(serviceReturnValue.Message); } return services; } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) timeService.Close(); } } }