Move local TM creation to management command

This potentially leads to broken upgrade process in massive projects,
so it is better to have it clearly separated from it and avoid scaring
people.

Also having this in a separate management command allows further
refinements in the logic.
Local TM command: allow to wipe out previously existing local TM
Local TM command: Try to avoid DB locking

If we run this for a setup with hundreds of thousands of units we are
locking the DB for a really long time, and if the computer has not enough
resources it might even hang.