Set device user id before inserting into db
Call server api for registrating device if data is valid

Display errors when something goes wrong