Implementing persistency layer over mongodb