/// <summary>
		/// Turns the given <paramref name="obj"/> in a cacheable object.
		/// </summary>
		/// <param name="obj">The <see cref="Record"/> for which to create the cacheable object.</param>
		/// <param name="query">The <see cref="Query"/> which resulted in the given <paramref name="obj"/>.</param>
		/// <returns>Returns the <see cref="CachedObject{TObject}"/>.</returns>
		public static CachedObject<Record> AsCacheableObject(this Record obj, Query query)
		{
			// validate arguments
			if (query == null)
				throw new ArgumentNullException("query");

			// create a new cacheable object
			var cacheable = new CachedObject<Record>(obj);

			// if the result is found, cache it by it's id
			ChildOfSpecification childOfSpecification;
			if (obj != null)
			{
				// generate an ID for this specific record
				var recordIdCacheKey = obj.CalculateIdCacheKey();

				// add that cache key as the dependency
				cacheable.Add((StringCacheKeyDependency) recordIdCacheKey);
			}
			else if (query.TryGetSpecification(out childOfSpecification))
			{
				// cache on the parent tree Id
				var parentTreeIdCacheKey = childOfSpecification.ParentPointer.CalculateTreeIdCacheKey();

				// add that cache key as the dependency
				cacheable.Add((StringCacheKeyDependency) parentTreeIdCacheKey);
			}
			else
			{
				// add the repository modified cache key
				cacheable.Add(CachingRepositoryDecorator.RepositoryModifiedDependency);
			}

			// return the cacheable  object
			return cacheable;
		}
		/// <summary>
		/// Turns the given <paramref name="obj"/> in a cacheable object.
		/// </summary>
		/// <param name="obj">The <see cref="Nodeset"/> for which to create the cacheable object.</param>
		/// <param name="query">The <see cref="Query"/> which resulted in the given <paramref name="obj"/>.</param>
		/// <returns>Returns the <see cref="CachedObject{TObject}"/>.</returns>
		/// <exception cref="ArgumentNullException">Thrown if <paramref name="obj"/> is null.</exception>
		public static CachedObject<Nodeset> AsCacheableObject(this Nodeset obj, Query query)
		{
			// validate arguments
			if (obj == null)
				throw new ArgumentNullException("obj");
			if (query == null)
				throw new ArgumentNullException("query");

			// create a new cacheable object
			var cacheable = new CachedObject<Nodeset>(obj);

			ChildOfSpecification childOfSpecification;
			if (query.TryGetSpecification(out childOfSpecification))
			{
				// cache on the parent tree Id
				var parentTreeIdCacheKey = childOfSpecification.ParentPointer.CalculateTreeIdCacheKey();

				// add that cache key as the dependency
				cacheable.Add((StringCacheKeyDependency) parentTreeIdCacheKey);
			}
			else
			{
				// add the repository modified cache key
				cacheable.Add(CachingRepositoryDecorator.RepositoryModifiedDependency);
			}

			// return the cacheable  object
			return cacheable;
		}