I have the following code to assign masterpage via CSOM but its not working, after I go to the site, it says File not Found, I guess URL is wrongly constructed.

Please note that I am not trying to set master page to root web, its subsite in a nested structrue

```
/rootweb
/rootweb/clients/c1
/rootweb/clients/c2

```

The only thing I can think of, is that the master page url should be relative to the rootweb of the site collection and not the subsite??

```
private static void BrandingSubsite(ClientContext clientContext, Web newWeb)
        {
            clientContext.Load(newWeb, w => w.ServerRelativeUrl);
            clientContext.ExecuteQuery();

            var masterPageUrl = String.Format("{0}/_catalogs/masterpage/SPCCapatech/FullWidth_SideBar.master", newWeb.ServerRelativeUrl);

            newWeb.MasterUrl = masterPageUrl;
            newWeb.CustomMasterUrl = masterPageUrl;
            newWeb.Update();
            clientContext.Load(newWeb);
            clientContext.ExecuteQuery();           
        }

```