Core: simplify code
Core: prepare differentiation in handling history actions
Core: only store the parameters for insert query
Core: only store the parameters for delete query
Core: store id only once in history per row