added some functionality in the dbFactory and the way users are saved