core: use getVm() or getTemplate instead of DAO access

use the internal caching of entities for the enclosing command 
and its descendants. 

Change-Id: Ia97195939c010b31ba26dcad4cc7347c3c25185f
Signed-off-by: Roy Golan <rgolan@redhat.com>