/*global define*/
'use strict';

define([
	'jquery',
	'backbone',
	'underscore',
	'epoxy'
], function ($, Backbone, _, Epoxy) {

	var M = Epoxy.Model.extend({

		toJSON: function (options) {
			var objects = Epoxy.Model.prototype.toJSON.apply(this, arguments);

			if (options && options.recursive === true) {
				_.each(objects, function (object, key) {
					if (object && object.toJSON && typeof object.toJSON === 'function') {
						objects[key] = object.toJSON(options);
					}
				});
			}

			return objects;
		}
	});

	return M;
});
@@ -153,16 +153,52 @@
 tend(%7B%0A%0A
+%09%09blacklist: %7B%7D,%0A%0A%09%09whitelist: %7B%7D,%0A%0A
 %09%09toJSON
@@ -224,97 +224,449 @@
 ) %7B%0A
+%0A
 %09%09%09var 
-objects = Epoxy.Model.prototype.toJSON.apply(this, arguments);%0A%0A%09%09%09if (options && 
+json = %7B%7D;%0A%0A%09%09%09options = options %7C%7C %7B%7D;%0A%0A%09%09%09if (options.mode) %7B%0A%09%09%09%09if (this.whitelist%5Boptions.mode%5D) %7B%0A%09%09%09%09%09json = _.pick(_.clone(this.attributes), this.whitelist%5Boptions.mode%5D);%0A%09%09%09%09%7D%0A%09%09%09%09else if (this.blacklist%5Boptions.mode%5D) %7B%0A%09%09%09%09%09json = _.omit(_.clone(this.attributes), this.blacklist%5Boptions.mode%5D);%0A%09%09%09%09%7D%0A%09%09%09%09else %7B%0A%09%09%09%09%09json = _.clone(this.attributes);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09json = _.clone(this.attributes);%0A%09%09%09%7D%0A%0A%09%09%09if (
 opti
@@ -702,23 +702,20 @@
 %09_.each(
-objects
+json
 , functi
@@ -814,23 +814,20 @@
 %7B%0A%09%09%09%09%09%09
-objects
+json
 %5Bkey%5D = 
@@ -885,15 +885,12 @@
 urn 
-objects
+json
 ;%0A%09%09

add whitelist and blacklist to model