Even when db column has unique constraint, empty string can be inserted into this column (but only one) and it'll be unique. In my opinion we should remove this if statement. Besides that - data should be adapted to code and db - not the other way.