Some issues fixed, added helper method for merge entities