Update bucket in machine table if already exists

What it used to to before (even in the original LWP I think), is create a new record in the machine table each time you use the edit form.

And because there was no unique constraint on machine.name field, multiple records would then be allowed into the db for a machine.

Added a unique constraint on the name field of the machine table, each machine has a unique name.

Also, update bucket token if a record already exists, otherwise create a new record.