DATACMND-525 - Cleanup part III.

Removed unused types.
Move new types to dedicated package for keyvalue.
Add some tests.