 			jsonExpressionSetter = @$parse( jsonExpression ).assign
 			jsonExpressionSetter json, propertyExpressionGetter @
 
-		# Assign all the aggregated resources
-		angular.forEach @$_propertyToResourceJsonMapping, ( aggregateResourceDefinition, propertyExpression ) =>
-			propertyExpressionGetter = @$parse propertyExpression
-
-			angular.forEach aggregateResourceDefinition, ( resourceClass, jsonExpression ) =>
-				jsonExpressionSetter = @$parse( jsonExpression ).assign
-
-				jsonAggregateResources = new Array()
-				isPropertyArray = no
-
-				aggregatedResourceObjectOrArray = propertyExpressionGetter @
-				return unless angular.isDefined aggregatedResourceObjectOrArray
-
-				if aggregatedResourceObjectOrArray instanceof resourceClass
-				# If the property is an instance of the given resource
-					jsonAggregateResources.push aggregatedResourceObjectOrArray.$_toJson()
-
-				else if angular.isArray aggregatedResourceObjectOrArray
-				# If the property is an array of instances of the given resource class
-					isPropertyArray = yes
-
-					for aggregatedResource in aggregatedResourceObjectOrArray
-						jsonAggregateResources.push aggregatedResource.$_toJson() if aggregatedResource instanceof resourceClass
-
-				else if angular.isObject( aggregatedResourceObjectOrArray )
-				# If the property is actually a hash of the given resource
-					isPropertyArray = yes
-
-					for aggregatedResource of aggregatedResourceObjectOrArray
-						jsonAggregateResources.push aggregatedResource.$_toJson() if aggregatedResource instanceof resourceClass
-
-				if isPropertyArray or jsonAggregateResources.length > 1
-					jsonExpressionSetter json, jsonAggregateResources
-				else
-					jsonExpressionSetter json, jsonAggregateResources[ 0 ]
+		@$_putResourcesOnto json, @$_propertyToResourceJsonMapping
 
 		angoolar.delete json, 'this' if @$_useThis
 

	# This method is used to initialize the resource after it's been created - i.e. including the constructor and JSON deserialization
	$_init: ->

	$_toJson: ->
		json = {}


				propertyExpressionSetter = propertyExpressionGetter.assign
				propertyExpressionSetter @, jsonValue

			@$_getResourcesFrom json, @$_propertyToResourceJsonMapping

			angoolar.delete json, 'this' if @$_useThis

		@$_init()

		@ # for method chaining

	$_putResourcesOnto: ( target, resourceMapping ) ->
		# Assign all the aggregated resources
		angular.forEach resourceMapping, ( aggregateResourceDefinition, propertyExpression ) =>
			propertyExpressionGetter = @$parse propertyExpression

			angular.forEach aggregateResourceDefinition, ( resourceClass, jsonExpression ) =>
				jsonExpressionSetter = @$parse( jsonExpression ).assign

				jsonAggregateResources = new Array()
				isPropertyArray = no

				aggregatedResourceObjectOrArray = propertyExpressionGetter @
				return unless angular.isDefined aggregatedResourceObjectOrArray

				if aggregatedResourceObjectOrArray instanceof resourceClass
				# If the property is an instance of the given resource
					jsonAggregateResources.push aggregatedResourceObjectOrArray.$_toJson()

				else if angular.isArray aggregatedResourceObjectOrArray
				# If the property is an array of instances of the given resource class
					isPropertyArray = yes

					for aggregatedResource in aggregatedResourceObjectOrArray
						jsonAggregateResources.push aggregatedResource.$_toJson() if aggregatedResource instanceof resourceClass

				else if angular.isObject( aggregatedResourceObjectOrArray )
				# If the property is actually a hash of the given resource
					isPropertyArray = yes

					for aggregatedResource of aggregatedResourceObjectOrArray
						jsonAggregateResources.push aggregatedResource.$_toJson() if aggregatedResource instanceof resourceClass

				if isPropertyArray or jsonAggregateResources.length > 1
					jsonExpressionSetter target, jsonAggregateResources
				else
					jsonExpressionSetter target, jsonAggregateResources[ 0 ]

	$_getResourcesFrom: ( target, resourceMapping ) ->
		# Assign all the aggregated resources
		angular.forEach resourceMapping, ( aggregateResourceDefinition, propertyExpression ) =>
			# We will first assume we're not going to be attributing these aggregated resources to the given propertyExpression evaluation as an array unless (1), any
			# of the aggregated resources (given by its corresponding jsonExpression) is an array, or (2), we have multiple aggregated resources
			# that each correspond to this same propertyExpression evaluation.
			isPropertyArray = no
			jsonResources = new Array()

			propertyExpressionGetter = @$parse propertyExpression
			propertyExpressionSetter = propertyExpressionGetter.assign

			angular.forEach aggregateResourceDefinition, ( resourceClass, jsonExpression ) =>
				jsonExpressionGetter = @$parse jsonExpression
				jsonResourceObjectOrArray = jsonExpressionGetter target

				if angular.isArray jsonResourceObjectOrArray
					isPropertyArray = isPropertyArray or yes
					for jsonResourceDatum in jsonResourceObjectOrArray
						jsonResources.push if jsonResourceDatum? then new resourceClass().$_fromJson( jsonResourceDatum ) else jsonResourceDatum
				else
					jsonResources.push if jsonResourceObjectOrArray? then new resourceClass().$_fromJson( jsonResourceObjectOrArray ) else jsonResourceObjectOrArray

			if isPropertyArray or jsonResources.length > 1
				propertyExpressionSetter @, jsonResources
			else
				propertyExpressionSetter @, jsonResources[ 0 ]

	$_getApiParameters: ->
		parameters = {}

		for property, apiParameter of @$_propertyToApiMapping
			parameters[ apiParameter ] = @[ property ] if @[ property ]?

		@$_putResourcesOnto parameters, @$_propertyToResourceApiMapping

		parameters

