/// <summary>
        /// Adds an embedded resource. There can be multiple resources with the same key, in which case a collection of resources will be built.
        /// </summary>
        /// <param name="key">The embedded resource key</param>
        /// <param name="resource">The embedded resource as represented by a CrichtonRepresentor</param>
        public void AddEmbeddedResource(string key, CrichtonRepresentor resource)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException("key");
            }

            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }

            if (!representor.EmbeddedResources.ContainsKey(key))
            {
                representor.EmbeddedResources[key] = new List <CrichtonRepresentor>();
            }

            representor.EmbeddedResources[key].Add(resource);
        }
        /// <summary>
        /// Sets the CrichtonRepresentor you are building to be a collection instead of a single object.
        /// </summary>
        /// <typeparam name="T">The type of the object contained in the collection, such as a Model or ViewModel type</typeparam>
        /// <param name="collection">The collection of objects that represent the collection. JSON.NET will be used to serialize the objects, so the objects can have standard JSON.NET attributes.</param>
        /// <param name="selfLinkFunc">A function that defines the Self Link. This will be called on each object to populate the Self Link of the CrichtonRepresentor.</param>
        public void SetCollection <T>(IEnumerable <T> collection, Func <T, string> selfLinkFunc)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (selfLinkFunc == null)
            {
                throw new ArgumentNullException("selfLinkFunc");
            }

            foreach (var item in collection)
            {
                var newRepresentor = new CrichtonRepresentor {
                    SelfLink = selfLinkFunc(item)
                };
                newRepresentor.SetAttributesFromObject(item);

                representor.Collection.Add(newRepresentor);
            }
        }
 /// <summary>
 /// Initializes a new instance of the RepresentorBuilder class.
 /// </summary>
 public RepresentorBuilder()
 {
     representor = new CrichtonRepresentor();
 }