// Methods
    public void Execute(ID formid, AdaptedResultList fields, params object[] data)
    {
      Assert.ArgumentNotNull(fields, "fields");
      Assert.IsNotNullOrEmpty(this.ContactsLists, "Empty contact list.");
      Assert.IsNotNull(Tracker.Current, "Tracker.Current");
      Assert.IsNotNull(Tracker.Current.Contact, "Tracker.Current.Contact");
      List<string> list = (from x in this.ContactsLists.Split(new char[] { ',' }) select ID.Parse(x).ToString()).ToList<string>();
      using (new SecurityDisabler())
      {
        Sitecore.Analytics.Tracking.Contact contact = Tracker.Current.Contact;

        var c = new XdbContactId(contact.ContactId);

        var recipientRepository = new XdbRecipientRepository();
        recipientRepository.UpdateRecipientEmail(c, fields.GetEntryByID(ID.Parse(this.EmailField)).Value);

        // new code
        
        ClientApi.UpdateSubscriptions(c, list.ToArray(), new string[] {}, Factory.Instance.GetManagerRoots().First().InnerItem.ID.ToString(), this.SendConfirmation);
      }
    }
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="field">
        /// The field.
        /// </param>
        /// <param name="list">
        /// The list.
        /// </param>
        /// <returns>
        /// The get value.
        /// </returns>
        protected string GetValue(XCrmField field, AdaptedResultList list)
        {
            if (field != null && list != null)
            {
                switch ((Core.Data.ValueFromType)field.UseValueType)
                {
                case Core.Data.ValueFromType.FromForm:

                    AdaptedControlResult formField = list.GetEntryByID(field.FormValueFrom);

                    if (formField != null)
                    {
                        return(formField.Value);
                    }

                    break;

                case Core.Data.ValueFromType.FromCrm:
                case Core.Data.ValueFromType.Manual:
                    return(field.CrmValue);

                case Core.Data.ValueFromType.PreviousAction:
                    dynamic contextCallWorkAround = this;

                    if (contextCallWorkAround.Context != null && contextCallWorkAround.Context.Parameters.ContainsKey(field.CrmValue))
                    {
                        var result = (FormsCrmEntity)contextCallWorkAround.Context.Parameters[field.CrmValue];
                        if (result != null)
                        {
                            field.EntityReference = result.Name;
                            return(result.ID == Guid.Empty ? null : result.ID.ToString());
                        }
                    }

                    break;
                }
            }

            return(null);
        }
        /// <summary>
        /// The get value source.
        /// </summary>
        /// <param name="field">
        /// The field.
        /// </param>
        /// <param name="list">
        /// The list.
        /// </param>
        /// <returns>
        /// The get value source.
        /// </returns>
        private string GetValueSource(XCrmField field, AdaptedResultList list)
        {
            switch ((Core.Data.ValueFromType)field.UseValueType)
            {
            case Core.Data.ValueFromType.FromForm:

                AdaptedControlResult formField = list.GetEntryByID(field.FormValueFrom);

                if (formField != null)
                {
                    return(formField.FieldName);
                }

                break;

            case Core.Data.ValueFromType.FromCrm:
                return("crm");

            case Core.Data.ValueFromType.Manual:
                return("manual");

            case Core.Data.ValueFromType.PreviousAction:
                FormItem form = this.CurrentForm;
                if (form != null)
                {
                    IActionItem action = DependenciesManager.ActionExecutor.GetAcitonByUniqId(form, field.CrmValue, true);
                    if (action != null)
                    {
                        return("previous action: {0}".FormatWith(action.DisplayName));
                    }
                }

                return("previous action: {0}".FormatWith(field.CrmValue));
            }

            return(string.Empty);
        }