Switch Sitecore context
using (new SiteContextSwitcher(SiteContextFactory.GetSiteContext("shell"))) { //perform actions }