Refactor Problem.merge!

This pull request refactor Problem.merge! to his own class and the problem update cache system.

Before merge, I hope some code-review please.