/// <summary>
        /// Get the specified request.
        /// </summary>
        /// <param name="request">Request.</param>
        public object Get(DataPackageSearchRequest request)
        {
            var context = TepWebContext.GetWebContext(PagePrivileges.EverybodyView);
            IOpenSearchResultCollection result = null;

            try {
                context.Open();
                context.LogInfo(this, string.Format("/data/package/{{DataPackageId}}/search GET DataPackageId='{0}'", request.DataPackageId));

                Terradue.Tep.DataPackage datapackage;

                try{
                    datapackage = DataPackage.FromIdentifier(context, request.DataPackageId);
                }catch (Exception) {
                    if (request.Key != null) //or if public
                    {
                        context.AccessLevel = EntityAccessLevel.Administrator;
                        datapackage         = DataPackage.FromIdentifier(context, request.DataPackageId);
                        if (request.Key != null && !request.Key.Equals(datapackage.AccessKey))
                        {
                            throw new UnauthorizedAccessException(CustomErrorMessages.WRONG_ACCESSKEY);
                        }
                    }
                    else
                    {
                        datapackage = DataPackage.FromIdentifier(context, request.DataPackageId);
                    }
                }

                if (Request.QueryString != null && Request.QueryString["cache"] == "false")
                {
                    datapackage.SetOpenSearchEngine(MasterCatalogue.GetNewOpenSearchEngine());
                }
                else if (Request.QueryString != null && Request.QueryString["clearcache"] == "true")
                {
                    datapackage.SetOpenSearchEngine(MasterCatalogue.ClearOpenSearchEngine());
                }
                else
                {
                    datapackage.SetOpenSearchEngine(MasterCatalogue.OpenSearchEngine);
                }

                OpenSearchEngine ose = MasterCatalogue.OpenSearchEngine;

                Type responseType = OpenSearchFactory.ResolveTypeFromRequest(HttpContext.Current.Request.QueryString, HttpContext.Current.Request.Headers, ose);

                result = ose.Query(datapackage, Request.QueryString, responseType);

                var openSearchDescription = datapackage.GetLocalOpenSearchDescription();
                var uri_s = datapackage.GetSearchBaseUrl();
                OpenSearchDescriptionUrl openSearchUrlByRel = OpenSearchFactory.GetOpenSearchUrlByRel(openSearchDescription, "self");
                Uri uri_d;
                if (openSearchUrlByRel != null)
                {
                    uri_d = new Uri(openSearchUrlByRel.Template);
                }
                else
                {
                    uri_d = openSearchDescription.Originator;
                }
                if (uri_d != null)
                {
                    result.Links.Add(new SyndicationLink(uri_d, "search", "OpenSearch Description link", "application/opensearchdescription+xml", 0));
                }
                if (uri_s != null)
                {
                    result.Links.Add(new SyndicationLink(uri_s, "self", "OpenSearch Search link", "application/atom+xml", 0));
                }

                MasterCatalogue.ReplaceSelfLinksFormat(result, Request.QueryString);

                ActivityTep activity = new ActivityTep(context, datapackage, EntityOperationType.Search);
                activity.SetParam("items", result.TotalResults + "");
                activity.Store();

                context.Close();
            } catch (Exception e) {
                context.LogError(this, e.Message, e);
                context.Close();
                throw e;
            }

            return(new HttpResult(result.SerializeToString(), result.ContentType));
        }