Checking if the ad is already registered before creating it.
Postgres kills the transaction in case of any sql exception.