public SportDto GetSport(int?id) { var model = new SportDto(); using (var client = new ToteService.BetListServiceClient()) { try { client.Open(); model = client.GetSport(id); 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); }