public void PopulateTest()
        {
            ConsentResponse target = new ConsentResponse(); // TODO: Initialize to an appropriate value
            XContainer root = new XElement("root",
                new XElement("result",
                    new XElement("url", "ABC"),
                    new XElement("import-id", 1),
                    new XElement("user-id", "ABC"),
                    new XElement("echo", "123")
                    )
                );
            target.Populate(root);

            Assert.AreEqual("ABC", target.Url);
        }
        private static List<string> GetContext(Api api, ConsentResponse consent)
        {
            List<string> lstEmail = new List<string>();
            try
            {
                bool complete = false;
                while (!complete)
                {
                    var events = api.Events(consent.ImportId);

                    foreach (var item in events.Events)
                        Console.WriteLine("{0}-{1}", item.Type, item.Status);

                    complete = events.IsComplete;
                }

                var contacts = api.Contacts(consent.ImportId);

                foreach (var item in contacts.Contacts)
                {
                    try
                    {
                        Console.WriteLine("{1}, {0} ({2})", item.FirstName, item.LastName, item.EmailAddresses.FirstOrDefault());
                        string emailAddresses = item.FirstName + "<~>" + item.LastName + "<~>" + item.EmailAddresses.FirstOrDefault();
                        lstEmail.Add(emailAddresses);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }

            return lstEmail;
        }
        private string GetMails(Api api, ConsentResponse consent)
        {
            string emails = string.Empty;
            try
            {
                

                GatherEmailByCloudSponge objGatherEmailByCloudSponge = new GatherEmailByCloudSponge();

                //List<string> lstFriendsEmail = objGatherEmailByCloudSponge.GetFriendsEmail(mailtype);
                // List<string> lstFriendsEmail = objGatherEmailByCloudSponge.GetFriendsEmail(domainKey, domainPassword);

                List<string> lstFriendsEmail = GetContext(api, consent);

                foreach (string item in lstFriendsEmail)
                {
                    try
                    {
                        emails += item + "<:>";
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error : " + ex.StackTrace);
                    }
                }

                emails = emails.Remove(emails.LastIndexOf("<:>"));

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.StackTrace);
            }
            return emails;
        }