Generate Models code