@Override
  public void execute() {
    CallContext.current()
        .setEventDetails(
            "Template Id: "
                + getEntityId()
                + (getSnapshotId() == null
                    ? " from volume Id: " + getVolumeId()
                    : " from snapshot Id: " + getSnapshotId()));
    VirtualMachineTemplate template = null;
    template = _templateService.createPrivateTemplate(this);

    if (template != null) {
      final List<TemplateResponse> templateResponses =
          _responseGenerator.createTemplateResponses(
              ResponseView.Restricted, template.getId(), snapshotId, volumeId, false);
      TemplateResponse response = new TemplateResponse();
      if (templateResponses != null && !templateResponses.isEmpty()) {
        response = templateResponses.get(0);
      }
      response.setResponseName(getCommandName());
      setResponseObject(response);
    } else {
      throw new ServerApiException(
          ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
    }
  }
 @Override
 public void execute() {
   VirtualMachineTemplate result = _templateService.updateTemplate(this);
   if (result != null) {
     TemplateResponse response =
         _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result);
     response.setObjectName("template");
     response.setTemplateType(
         result.getTemplateType().toString()); // Template can be either USER or ROUTING type
     response.setResponseName(getCommandName());
     setResponseObject(response);
   } else {
     throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
   }
 }