private static IEnumerable <IDereferencableLink> CreateLink( IHydraResource owner, IDereferencableLink relationResource, IResource @object, Iri type) { var result = relationResource.Copy(GetNextIri(type.ToString().Replace(hydra.Namespace, String.Empty))); var proxy = result.Unwrap(); proxy.SetProperty(ResourceExtensions.TargetPropertyInfo, @object); result.Type.AddIfNotExist(type); result.Type.Remove(type == hydra.TemplatedLink ? hydra.Link : hydra.TemplatedLink); if (type == hydra.TemplatedLink && @object != null) { var templatedLink = result.ActLike <ITemplatedLink>(); proxy.SetProperty(IriTemplatePropertyInfo, @object.ActLike <IIriTemplate>()); result = templatedLink; } owner.Links.Add(result); return(new[] { result }); }