private IEnumerable <RestItem> GetRoot() { var stopwatch = new Stopwatch(); var messageStringBuilder = new StringBuilder("GetRoot request..."); try { stopwatch.Start(); var getRootResponse = ConnectClient.Login(); messageStringBuilder.AppendFormat("took {0}ms", stopwatch.ElapsedMilliseconds); stopwatch.Restart(); if (getRootResponse.ErrorException != null || getRootResponse.Content == null) { RestErrorHelper.LogRestError(Logger, getRootResponse, "GetRoot HTTP error"); throw new Exception("Error calling GetRoot", getRootResponse.ErrorException); } if (getRootResponse.StatusCode == HttpStatusCode.Unauthorized) { throw new NotAuthenticatedException("Username or password are incorrect"); } if (getRootResponse.Content != null) { return(getRootResponse.Content.FromJson <List <RestItem> >()); } } catch (NotAuthenticatedException) { throw; } catch (Exception ex) { Logger.LogError("GetRoot exception", ex); throw; } finally { Logger.LogError(messageStringBuilder.ToString()); stopwatch.Stop(); } return(null); }