Update relationship between image/template/vm, update delete functions