Improved user storing in database and tests for that