Save record to db. If exists, will update it.