public static File transform(Target target, Type type) throws TransformException {
    	String conditional = target.getCondition();
    	if(!StringUtils.isBlank(conditional)){
    		Condition c = Context.getCondition(conditional);
    		if(c == null){
    			throw new TransformException("Condition [" + conditional + "] does not exist!");
    		}
    		if(!ExpressionEvaluator.evaluateExpression(c.getExpression(), type)){
        		return null;
    		}
    	}
    	
        File outputFile = null;
        FileWriter fw = null;
        Template template = null;
        try {
            outputFile = OutputFileManager.getOutputFile(target, type);
            fw = new FileWriter(outputFile, false);

            VelocityContext vc = new VelocityContext();
            vc.put("context", Context.instance());
            vc.put("target", target);
            vc.put("type", type);
            addUtilities(vc);

            template = Context.getTemplateManager().getTemplate(target);
            template.merge(vc, fw);

            fw.close();
        } catch (ResourceNotFoundException ex) {
            Logger.getLogger(TemplateManager.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransformException("Template [" + template.getName() + "] not found", ex);
        } catch (ParseErrorException ex) {
            Logger.getLogger(TemplateManager.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransformException("Unable to parse template [" + template.getName() + "]", ex);
        } catch (MethodInvocationException ex) {
            Logger.getLogger(TemplateManager.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransformException("Unknown problem with template [" + template.getName() + "]", ex);
        } catch (IOException ex) {
            Logger.getLogger(TypeTransformer.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransformException("Unable to write to file [" + outputFile.getName() + "]", ex);
        } catch (OverwriteException ex) {
            Logger.getLogger(TypeTransformer.class.getName()).log(Level.INFO, "Output file [" + ex.getOutputFileName() + "] already exists");
        } catch (Exception ex) {
            Logger.getLogger(TypeTransformer.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransformException("Unable to write to file [" + outputFile.getName() + "]", ex);
        }

        return outputFile;
    }