CMS-2192 Templates API design.
Moved some classes from api to core.