def unsubscribe(options = {})
      unsubscribed_at = options[:unsubscribed_at] || Time.current
      new_attributes = { subscribing:          false, unsubscribed_at:          unsubscribed_at,
                         subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at,
                         optional_targets: optional_targets }
      optional_target_names.each do |optional_target_name|
        new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(
          Subscription.to_optional_target_key(optional_target_name) => false,
          Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => subscribed_at)
      end
      update(new_attributes)
    end
def unsubscribe(options = {})
      unsubscribed_at = options[:unsubscribed_at] || Time.current
      new_attributes = { subscribing:          false, unsubscribed_at:          unsubscribed_at,
                         subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at,
                         optional_targets: optional_targets }
      optional_target_names.each do |optional_target_name|
        new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(
          Subscription.to_optional_target_key(optional_target_name) => false,
          Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => subscribed_at)
      end
      update(new_attributes)
    end
Unsubscribes to the notification and notification email.

 @param [Hash] options Options for unsubscribing to the notification
 @option options [DateTime] :unsubscribed_at (Time.current) Time to set to unsubscribed_at and unsubscribed_to_email_at of the subscription record
 @return [Boolean] If successfully updated subscription instance