refactoring mongo portal saving