public void CreateListFromJsonString()
        {
            //arrange
            string s      = "{\"href\":\"https://api.intelliflo.com/v2/clients/30944834/contactdetails\",\"first_href\":\"https://api.intelliflo.com/v2/clients/30944834/contactdetails?top=100&skip=0\",\"items\":[{\"id\":30075068,\"href\":\"https://api.intelliflo.com/v2/clients/30944834/contactdetails/30075068\",\"type\":\"Email2\",\"value\":\"[email protected]\",\"isDefault\":true},{\"id\":30075068,\"href\":\"https://api.intelliflo.com/v2/clients/30944834/contactdetails/30075068\",\"type\":\"Email\",\"value\":\"[email protected]\",\"isDefault\":true}],\"count\":3}";
            JArray jarray = Tools.ExtractItemsArrayFromJsonString(s);

            //act
            List <EmailAddress> emails = EmailAddress.CreateList(jarray);

            //assert
            Assert.AreEqual(2, emails.Count);
        }
        private static async void GetAdditionalData(MLFSClient client, string endpoint)
        {
            string        url      = String.Format("clients/{0}/{1}", client.PrimaryID, endpoint);
            IRestResponse response = await IOConnection.GetResponse(url);

            if (response.Content.Length != 0)
            {
                JArray              _array    = Tools.ExtractItemsArrayFromJsonString(response.Content);
                List <Address>      addresses = new List <Address>();
                List <Number>       numbers   = new List <Number>();
                List <EmailAddress> emails    = new List <EmailAddress>();
                if (endpoint == "addressess")
                {
                    addresses = Address.CreateList(_array);
                }
                if (endpoint == "contactdetails")
                {
                    JArray jarray = Tools.SplitContactDetails(_array);
                    numbers = Number.CreateList(jarray);
                    jarray  = Tools.SplitContactDetails(_array, true);
                    emails  = EmailAddress.CreateList(jarray);
                }
                if (client.IsIndividual)
                {
                    client.Person.Addresses      = addresses;
                    client.Person.EmailAddresses = emails;
                    client.Person.Numbers        = numbers;
                }
                else
                {
                    if (client.Organisation == null)
                    {
                        client.Organisation = new Organisation();
                    }
                    client.Organisation.Addresses = addresses;
                    client.Organisation.Numbers   = numbers;
                }
            }
        }