Sitecore offers different "switchers", the mostly used ones are:
  • Sitecore.Globalization.LanguageSwitcher for switching the Sitecore.Context.Language.
  • Sitecore.Sites.SiteContextSwitcher for switching the Sitecore.Context.Site.
  • Sitecore.Data.DatabaseSwitcher for switching the Sitecore.Context.Database, i.e. to read something out of the master database on a delivery environment (but be careful with this!).
  • Sitecore.Security.Accounts.UserSwitcher for switching the Sitecore.Context.User, i.e. to execute some code with administrator permissions.
https://ctor.io/correctly-switching-sitecore-contextes/