CMS-4198 Improve Context api so that it's easier to integrate with

Added proper test