public UserDto ExistsUser(string login, string password) { var model = new UserDto(); using (var client = new UserService.UserServiceClient()) { try { client.Open(); model = client.ExistsUser(login, password); 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); }