 
   DEFAULT_CAMPAIGN = "register"
 
+  deleteExistingCampaign = (data, callback)->
+
+    {name} = data
+
+    return callback new KodingError "Name not provided"  unless name
+
+    JRewardCampaign.one {name}, (err, campaign)->
+
+      return callback err  if err
+      return callback null unless campaign
+
+      campaign.remove callback
 
 
   # Private Methods

{Model}   = require 'bongo'
jraphical = require 'jraphical'

module.exports = class JRewardCampaign extends jraphical.Module

  # An example to create in client side by an administrator
  #
  #
  # KD.remote.api.JRewardCampaign.create(
  #   {

  #     console.log(err, campaign);
  #   }
  # );
  #
  # # Find & Modify
  #
  # var campaign = null;
  #
  # KD.remote.api.JRewardCampaign.one(
  #   {
  #     name: "register"
  #   }, function(err, _campaign){
  #     if (err) {
  #       console.warn(err);
  #     }
  #     else if (_campaign) {
  #       campaign = _campaign;
  #       console.log("Campaign assigned to local variable `campaign`");
  #     }
  #     else {
  #       console.error("No campaign found.");
  #     }
  #   }
  # );
  #
  # if (campaign) {
  #   campaign.update({isActive: false}, log);
  # }
  #


  {signature, secure} = require 'bongo'

