public ILinkBuilder <IResourceLinksBuilder <TParentBuilder, TResource> > Link(string rel, Func <TResource, bool> predicate)
        {
            Contract.Requires(String.IsNullOrWhiteSpace(rel) == false);

            var domReadWriteLinksCollectionCount = this.DomReadWriteLinksCollection.Count;
            var clrResourceCollectionCount       = this.ClrResourceCollection.Count;

            if (clrResourceCollectionCount != domReadWriteLinksCollectionCount)
            {
                var detail = ServerErrorStrings
                             .InternalErrorExceptionDetailCollectionCountMismatch
                             .FormatWith("DOM read-write links collection", domReadWriteLinksCollectionCount, "CLR resource collection", clrResourceCollectionCount);
                throw new InternalErrorException(detail);
            }

            var domReadWriteLinksCollectionFiltered = new List <DomReadWriteLinks>();
            var count = clrResourceCollectionCount;

            for (var i = 0; i < count; ++i)
            {
                var clrResource = this.ClrResourceCollection[i];
                var canAddLink  = predicate == null || predicate(clrResource);
                if (canAddLink == false)
                {
                    continue;
                }

                var domReadWriteLinks = this.DomReadWriteLinksCollection[i];
                domReadWriteLinksCollectionFiltered.Add(domReadWriteLinks);
            }

            var linkBuilder = new LinkCollectionBuilder <IResourceLinksBuilder <TParentBuilder, TResource> >(this.Builder, domReadWriteLinksCollectionFiltered, rel);

            return(linkBuilder);
        }
        public ILinkBuilder <TBuilder> Link(string rel)
        {
            Contract.Requires(String.IsNullOrWhiteSpace(rel) == false);

            var linkCollectionBuilder = new LinkCollectionBuilder <TBuilder>(this.Builder, this.DomReadWriteLinksCollection, rel);

            return(linkCollectionBuilder);
        }