public async Task <IHttpActionResult> PostHomePageByUriAsync(string uri, [FromBody] string homePageUri, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(uri, cancellationToken); await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanEdit, cancellationToken); ValidationResult validationResult; if (homePageUri == null) { validationResult = await _portalManager.SetHomePageAsync(portal, null, cancellationToken); } else { var masterPage = await _portalManager.GetPageByUriAsync(portal, homePageUri, cancellationToken); if (masterPage == null) { return(BadRequest(string.Format(PortalApiResources.PageNotFound, uri))); } validationResult = await _portalManager.SetHomePageAsync(portal, masterPage, cancellationToken); } if (!validationResult.Succeeded) { return(this.ValidationContent(validationResult)); } return(Ok()); }