 		return resources[index]
 	}
 	
-	/// Returns a loaded resource identified by the given type and id,
-	/// or nil if no loaded resource was found.
+	/// Returns a resource identified by the given type and id,
+	/// or nil if no resource was found.
 	public subscript (type: String, id: String) -> Resource? {
 		return resources.filter { $0.id == id && $0.resourceType == type }.first
 	}

	}
}

/**
A LinkedResourceCollection represents a collection of resources that is linked from another resource.
The main differences with ResourceCollection is that it is mutable,
and the addition of `linkage`, and a self `URL` property.

A LinkedResourceCollection keeps track of resources that are added to and removed from the collection.
This allows Spine to make partial updates to the collection when it is persisted.
*/
public class LinkedResourceCollection: ResourceCollection {
	/// The type/id pairs of resources present in this link.
	public var linkage: [ResourceIdentifier]?

	public var count: Int {
		return resources.count
	}
	
	// MARK: Mutators
	
	/// Append `resource` to the collection.
	public func appendResource(resource: Resource) {
		assert(resource.id != nil, "Cannot appendResource resource that hasn't been persisted yet.")
		resources.append(resource)
	}
}

extension ResourceCollection: SequenceType {
