SYMPHONY-1696 Added duplicate migration detection. Minor refactoring.