/// <summary>
        /// Replaces the resource.
        /// </summary>
        /// <param name="resource">The resource to reset.</param>
        /// <returns></returns>
        object IUpdatable.ResetResource(object resource)
        {
            IUpdatable update = this;

            // Create a new resource of the same type
            // but only make a local copy as we're only using it to set the default fields
            // Get the metadata
            IClassMetadata metadata = session.SessionFactory.GetClassMetadata(resource.GetType().ToString());
            object         tempCopy = metadata.Instantiate(null, EntityMode.Poco);

            for (int i = 0; i < metadata.PropertyNames.Length; i++)
            {
                var propertyType = metadata.PropertyTypes[i];
                var propName     = metadata.PropertyNames[i];

                if (!propertyType.IsEntityType)
                {
                    object value = metadata.GetPropertyValue(tempCopy, propName, EntityMode.Poco);
                    update.SetValue(resource, propName, value);
                }
            }

            //Return the new resource
            return(resource);
        }
        /// <summary>
        /// Creates the resource.
        /// </summary>
        /// <param name="containerName">Name of the container.</param>
        /// <param name="fullTypeName">Full name of the type.</param>
        /// <returns>Newly created Resource</returns>
        object IUpdatable.CreateResource(string containerName, string fullTypeName)
        {
            // Get the metadata
            IClassMetadata metadata    = session.SessionFactory.GetClassMetadata(fullTypeName);
            object         newResource = metadata.Instantiate(null, EntityMode.Poco);

            // We can't save it to the session as it may not be valid yet
            // This happens if the key is a non-initancable key (e.g. Northwind.Customers)
            // So we save them to a local cache.  Only when SaveAll happens will be push them to the Session
            UpdateCache.Add(newResource);

            // Returns the new resource
            return(newResource);
        }