Error handling and upsert support

When posting a mapping has success/error messages. Upserts mapping
instead of discarding if they exist in database.