working save with unique constraint