How can this happen? I suppose there should be unique constraint on the name. However I could be less strict and do if count($roles) < count($roleNames) ?