public async Task <object> Post()
        {
            var featureManager = new UrlRewriteFeatureManager();

            if (featureManager.IsInstalled())
            {
                throw new AlreadyExistsException(RewriteHelper.DISPLAY_NAME);
            }

            if (Os.IsNanoServer)
            {
                throw new ApiNotAllowedException("Action not supported on current platform", null);
            }

            await featureManager.Install();

            dynamic settings = RewriteHelper.ToJsonModel(null, null);

            return(Created(RewriteHelper.GetLocation(settings.id), settings));
        }
        public async Task Delete(string id)
        {
            RewriteId rewriteId = new RewriteId(id);

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;

            Site site = (rewriteId.SiteId != null) ? SiteHelper.GetSite(rewriteId.SiteId.Value) : null;

            var featureManager = new UrlRewriteFeatureManager();

            // When target is webserver, uninstall
            if (rewriteId.SiteId == null && featureManager.IsInstalled())
            {
                if (Os.IsNanoServer)
                {
                    throw new ApiNotAllowedException("Action not supported on current platform", null);
                }

                await featureManager.Uninstall();
            }
        }