Change datasource history save logic

An entity for each topic.
Clean old data when do save.