/// <summary>
        /// Create or Update A Constant Contact List
        /// </summary>
        /// <param name="members">List to Export </param>
        /// <param name="listName">Name Of List</param>
        /// <returns></returns>

        public async Task <ServiceResponse> ExportConstantContactList(IList <PaaMember> members, string listName)
        {
            // find existing list or create new one
            ContactList requestedList = await ConstantContactService.GetListByListName(listName, true);

            // build the export structure
            ContactImport import = BuildContactImport(members, new List <string> {
                requestedList.Id
            });


            var bulkActivitiesService = ConstantContact.BulkListsService();

            try
            {
                // clear any existing list
                ConstantContactBulkResponse clearResponse = await ClearConstantContactList(requestedList.Id);


                if (import.ImportData.Count() < 1)  // nothing to add
                {
                    return(new ServiceResponse
                    {
                        Name = listName,
                        Success = true,
                        SuccessCount = 0,
                        ErrorCount = 0,
                        Message = "Success"
                    });
                }

                else
                {
                    BulkActivityResponse response = await bulkActivitiesService.ImportContactsAsync(import);

                    return(new ServiceResponse
                    {
                        Name = listName,
                        Success = true,
                        SuccessCount = int.Parse(response.ContactCount),
                        ErrorCount = int.Parse(response.ErrorCount),
                        Message = "Success"
                    });
                }
            }

            catch (Exception ex)
            {
                return(new ServiceResponse
                {
                    Name = listName,
                    Success = false,
                    Message = "Failed",
                    ExceptionMessage = ex.Message
                });
            }
        }
        public static async Task <BulkActivityResponse> ClearConstantContactListByName(string listName)
        {
            string listId = await GetContactListById(listName);

            var work = new ContactLists {
                Lists = new string[] { listId }
            };

            var bulkActivitiesService     = BulkListsService();
            BulkActivityResponse response = await bulkActivitiesService.ClearContactListsAsync(work);

            return(response);
        }
        public static async Task <ConstantContactBulkResponse> ClearConstantContactList(string listId)
        {
            var work = new ContactLists {
                Lists = new string[] { listId }
            };

            var bulkActivitiesService     = ConstantContactHelper.BulkListsService();
            BulkActivityResponse response = await bulkActivitiesService.ClearContactListsAsync(work);

            return(new ConstantContactBulkResponse
            {
                Id = response.Id,
                ContactCount = int.Parse(response.ContactCount),
                ErrorCount = int.Parse(response.ErrorCount)
            });
        }
        public static async Task <ConstantContactBulkResponse> ExportConstantContactList(List <ConstantContactMember> members, string listId)
        {
            var listNames = new List <string> {
                listId
            };

            ContactImport import = BuildContactImport(members, listNames);

            var bulkActivitiesService = ConstantContactHelper.BulkListsService();

            BulkActivityResponse response = await bulkActivitiesService.ImportContactsAsync(import);


            return(new ConstantContactBulkResponse
            {
                Id = response.Id,
                ContactCount = int.Parse(response.ContactCount),
                ErrorCount = int.Parse(response.ErrorCount)
            });
        }