/// <summary>
        /// Gets the single related CLR resource referenced by the "to-one" relationship.
        /// </summary>
        /// <typeparam name="TResource">Type of related CLR resource to get.</typeparam>
        /// <param name="relationship">The "to-one" relationship object that defines the
        /// single related CLR resource by json:api resource linkage.</param>
        /// <returns>Returns the single related CLR resource referenced by the "to-one"
        /// relationship if it exists, null otherwise.</returns>
        /// <exception cref="DocumentReadException">Is thrown if the relationship object
        /// passed is a "to-many" relationship instead of a "to-one" relationship.</exception>
        public static TResource GetRelatedResource <TResource>(this IDocumentReader documentReader, Relationship relationship)
            where TResource : class, IResource
        {
            Contract.Requires(documentReader != null);
            Contract.Requires(relationship != null);

            var clrRelatedResourceType = typeof(TResource);
            var clrRelatedResource     = (TResource)documentReader.GetRelatedResource(clrRelatedResourceType, relationship);

            return(clrRelatedResource);
        }