lib/datastore.js
function findRegisteredIdentifier(modelOrCollection) {
	var foundKey;

	for(var key in this.registeredModelsAndCollections) {
		var registeredModelOrCollection =
			this.registeredModelsAndCollections[key];

		if(modelOrCollection.constructor === registeredModelOrCollection) {
			foundKey = key;
			break;
		} else {
			if(_.has(registeredModelOrCollection, 'collectionClass') &&
				modelOrCollection.constructor ===
				registeredModelOrCollection.collectionClass) {

				foundKey = key;
				break;
			}
		}
	}

	return foundKey;
}
function findRegisteredIdentifier(modelOrCollection) {
	var foundKey;

	for(var key in this.registeredModelsAndCollections) {
		var registeredModelOrCollection =
			this.registeredModelsAndCollections[key];

		if(modelOrCollection.constructor === registeredModelOrCollection) {
			foundKey = key;
			break;
		} else {
			if(_.has(registeredModelOrCollection, 'collectionClass') &&
				modelOrCollection.constructor ===
				registeredModelOrCollection.collectionClass) {

				foundKey = key;
				break;
			}
		}
	}

	return foundKey;
}
Function: findRegisteredIdentifier
Scans the registered models and collections for the given model. When found,
the identifier of the registration gets returned. Otherwise undefined is
returned.

Parameters:
(<Barefoot.Model>, <Barefoot.Collection>) model - Concrete instance of a
model or collection.

Returns:
(String, undefined) the identifier of model if found, undefined if no
match