Consider useing private_db of a and b and iterating over them and while iterating generate new content data instance, without clone/copy of db. Creating the merged one from scratch.