public IReadOnlyList <EventDto> GetEvents() { var model = new List <EventDto>(); using (var client = new ToteService.BetListServiceClient()) { try { client.Open(); var events = client.GetEventsAll(); foreach (var _event in events) { model.Add(_event); } client.Close(); if (model == null) { throw new NullReferenceException(); } } 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); }