PLA-1842 Saving of data;

WIP; Beware of ugly hacks and code duplication