/// <summary>
        /// Adds references specific to news items
        /// </summary>
        /// <param name="HyperMediaModel">news item dto or news item details dto to add references to</param>
        /// <param name="Id">Id of news item resource to add reference to</param>
        private static void AddNewsItemReferences(this HyperMediaModel HyperMediaModel, int Id, IEnumerable <NewsItemCategoryRelation> categoryRelations, IEnumerable <AuthorNewsItemRelation> authorRelations)
        {
            // routes needed for links
            string newsItemRoute   = Routes.BASE + Routes.NEWS_ITEM;
            string authorRoute     = Routes.BASE + Routes.AUTHORS;
            string categoriesRoute = Routes.BASE + Routes.CATEGORIES;

            // add get, edit and update links for actions on this resource
            HyperMediaModel.AddBaseReferences(Id, newsItemRoute);

            // For each author associated with resouce, add link for getting detail info on it
            Func <int, string> linkAuthorByNewsItem = authorId => authorRoute + "/" + authorId;

            foreach (var item in authorRelations)
            {
                HyperMediaModel.Links.AddToReferenceList("authors", linkAuthorByNewsItem(item.AuthorId));
            }

            // For each category associated with resouce, add link for getting detail info on it
            Func <int, string> linkCategoryDetailByNewsItem = categoryId => categoriesRoute + "/" + categoryId;

            foreach (var item in categoryRelations)
            {
                HyperMediaModel.Links.AddToReferenceList("categories", linkCategoryDetailByNewsItem(item.CategoryId));
            }
        }
        /// <summary>
        /// Adds appropriate references to categories resources
        /// </summary>
        /// <param name="HyperMediaModel">category dto or category details dto to add references to</param>
        /// <param name="Id">Id of category resource to add reference to</param>
        private static void AddCategoryReferences(this HyperMediaModel HyperMediaModel, int Id)
        {
            // routes needed for links
            string categoriesRoute = Routes.BASE + Routes.CATEGORIES;

            // add get, edit and update links for actions on this resource
            HyperMediaModel.AddBaseReferences(Id, categoriesRoute);
        }
        /// <summary>
        /// Adds references to authors resources
        /// Needs list on author news item relations so that news items for authors are correctly referenced
        /// </summary>
        /// <param name="HyperMediaModel">author dto or author details dto to add references to</param>
        /// <param name="Id">Id of author resource to add reference to</param>
        /// <param name="newsItems">All news items associated with author</param>
        private static void AddAuthorReferences(this HyperMediaModel HyperMediaModel, int Id, IEnumerable <AuthorNewsItemRelation> newsItems)
        {
            // routes needed for links
            string newsItemRoute = Routes.BASE + Routes.NEWS_ITEM;
            string authorRoute   = Routes.BASE + Routes.AUTHORS;

            // add get, edit and update links for actions on this resource
            HyperMediaModel.AddBaseReferences(Id, authorRoute);

            // add links to get list of all authored items for this resource
            string linkToAllAuthoredNewsItems = authorRoute + "/" + Id + "/newsItems";

            HyperMediaModel.Links.AddReference("newsItems", linkToAllAuthoredNewsItems);

            // add links to get a detail info of news item related to this resource
            Func <int, string> linkNewsItemDetailByAuthor = newsItemId => newsItemRoute + "/" + newsItemId;

            foreach (var item in newsItems)
            {
                HyperMediaModel.Links.AddToReferenceList("newsItemsDetailed", linkNewsItemDetailByAuthor(item.NewsItemId));
            }
        }