Add auto generation id function