Memory persistence backend improvements

* got rid of globals -- all data now belongs to backend instance;
* be more accurate and consistent with copying saved data.

Change-Id: I3e54415e23b7df03e48de3d6c0800f0149051560
Remove d2to dependency

Change-Id: I433711ba417dbb15f616fa488cec389f3138b00a
Merge "Memory persistence backend improvements"
Merge "Remove d2to dependency"