deposit: refactor of metadata processing

Signed-off-by: Pedro Gaudêncio <pedro.gaudencio@cern.ch>