private void SetCampaignTrackingCookie(string email, string recipientListId) { // Use the cookie helper to drop the Campaign tracking cookie var datasourceId = _campaignConnector.GetDataSources().First().Id.ToString(); var trackingCookie = _cookieHelper.GetTrackingCookie(_campaignConnector.Id.ToString(), _campaignConnector.InstanceId.ToString()); var data = trackingCookie.FirstOrDefault(cd => cd.DatasourceId == datasourceId); if (data != null) { data.EntityId = email; data.DatasourceId = recipientListId; } else { var item = new CookieData { DatasourceId = recipientListId, EntityId = email }; trackingCookie.Add(item); } _cookieHelper.UpsertTrackingCookie( _campaignConnector.Id.ToString(), _campaignConnector.InstanceId.ToString(), trackingCookie); }