public IActionResult GetAuthorCollections([ModelBinder(BinderType = typeof(ArrayModelBinder))] IEnumerable <Guid> ids)
        {
            if (ids == null)
            {
                return(BadRequest());
            }


            var authorEntities = libraryRepository.GetAuthors(ids);

            if (ids.Count() != authorEntities.Count())
            {
                return(NotFound());
            }

            var authorsToReturn = Mapper.Map <IEnumerable <AuthorDto> >(authorEntities);

            return(Ok(authorsToReturn));
        }
        //public IActionResult GetAuthors([FromQuery(Name = "page")]int pageNumber = 1, [FromQuery] int pageSize = 10)
        public IActionResult GetAuthors(AuthorsResourceParameters authorsResourceParameters, [FromHeader(Name = "Accept")] string mediaType)
        {
            if (!_propertyMappingService.ValidMappingExistsFor <AuthorDto, Author>(authorsResourceParameters.OrderBy))
            {
                return(BadRequest());
            }

            if (!_typeHelperService.TypeHasProperties <AuthorDto>(authorsResourceParameters.Fields))
            {
                return(BadRequest());
            }

            var authorsFromRepo = _libraryRepository.GetAuthors(authorsResourceParameters);



            var authors = Mapper.Map <IEnumerable <AuthorDto> >(authorsFromRepo);

            if (mediaType.Equals("application/vnd.marvin.hateos+json"))
            {
                var paginationMetadata = new
                {
                    totalCount  = authorsFromRepo.TotalCount,
                    pageSize    = authorsFromRepo.PageSize,
                    currentPage = authorsFromRepo.CurrentPage,
                    totalPages  = authorsFromRepo.TotalPages,
                };

                Response.Headers.Add("X-Pagination", Newtonsoft.Json.JsonConvert.SerializeObject(paginationMetadata));

                var links = CreateLinksForAuthors(authorsResourceParameters, authorsFromRepo.HasNext,
                                                  authorsFromRepo.HasPrevious);

                var shapedAuthors = authors.ShapeData(authorsResourceParameters.Fields);


                var shapedAuthorsWithLinks = shapedAuthors.Select(author =>
                {
                    var authorAsDictionary = author as IDictionary <string, object>;
                    var authorLinks        = CreateLinksForAuthor(
                        (Guid)authorAsDictionary["Id"], authorsResourceParameters.Fields);

                    authorAsDictionary.Add("links", authorLinks);

                    return(authorAsDictionary);
                });

                var linkedCollectionResource = new
                {
                    value = shapedAuthorsWithLinks,
                    links = links
                };

                return(Ok(linkedCollectionResource));
            }
            else
            {
                var previousPageLink = authorsFromRepo.HasPrevious ?
                                       CreateAuthorsResourceUri(authorsResourceParameters,
                                                                ResourceUriType.PreviousPage) : null;

                var nextPageLink = authorsFromRepo.HasNext ?
                                   CreateAuthorsResourceUri(authorsResourceParameters,
                                                            ResourceUriType.NextPage) : null;

                var paginationMetadata = new
                {
                    previousPageLink,
                    nextPageLink,
                    totalCount  = authorsFromRepo.TotalCount,
                    pageSize    = authorsFromRepo.PageSize,
                    currentPage = authorsFromRepo.CurrentPage,
                    totalPages  = authorsFromRepo.TotalPages
                };

                Response.Headers.Add("X-Pagination",
                                     Newtonsoft.Json.JsonConvert.SerializeObject(paginationMetadata));

                return(Ok(authors.ShapeData(authorsResourceParameters.Fields)));
            }
        }