Continued work on duplicates search. SQL is working for selecting all parents. There's a bug in the rebuilding, though.