minor fixes

* add checking if user from domain already exists
* check if legacy domain even exists
* fixed domain in db, it's authz not profile
* fixed commiting of db, was inverted
* profile was not written only logged