createUser returns User* instead of void in order to work with thread.