updated module to save users to database