private Organisations GetOrganisations()
        {
            HttpResponseMessage response = null;

            var connectionsUrl = $"{Settings.XeroBaseUrl}{Endpoints.Connections}";

            try
            {
                response = _httpClient.Get(connectionsUrl);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Connections request failed: " + ex.Message);
            }

            if (response != null)
            {
                Console.WriteLine("Xero connections request status: " + response.StatusCode);

                if (response.StatusCode == HttpStatusCode.OK && response.Content != null)
                {
                    var connectionsResponseString = response.Content.ReadAsStringAsync().Result;

                    Console.WriteLine(connectionsResponseString);

                    var connections = JsonConvert.DeserializeObject <Connections>(connectionsResponseString);

                    var organisations = new Organisations();

                    foreach (var connection in connections)
                    {
                        var organisationsUrl = $"{Settings.XeroBaseUrl}{ApiAccounting}{Endpoints.Organisations}";

                        response = _httpClient.Get(organisationsUrl, new Dictionary <string, string> {
                            { Headers.XeroTenantId, $"{connection.TenantId}" }
                        });

                        var apiResponseString = response.Content.ReadAsStringAsync().Result;

                        var apiResponse = JsonConvert.DeserializeObject <XeroApiResponse>(apiResponseString);

                        organisations.AddRange(apiResponse.Organisations);
                    }

                    return(organisations);
                }
                else if (response.StatusCode == HttpStatusCode.Unauthorized)
                {
                    throw new UnauthorisedException();
                }
            }

            return(null);
        }