LPS-40068 Improve usage of VelocityContext.
LPS-40086 Move common logic to AbstractTemplate, no changes.
LPS-40086 Add checking for key.