public IReadOnlyList <BetListDto> GetBetsAll() { var model = new List <BetListDto>(); using (var client = new ToteService.BetListServiceClient()) { try { client.Open(); var bets = client.GetBetsAll(); foreach (var bet in bets) { model.Add(bet); } if (model == null) { throw new NullReferenceException(); } client.Close(); } catch (FaultException <CustomException> customEx) { log.Error(customEx.Message); return(null); } catch (CommunicationException commEx) { log.Error(commEx.Message); return(null); } catch (NullReferenceException nullEx) { log.Error(nullEx.Message); return(null); } } return(model); }