Add transaction management to management commands

Signed-off-by: Michal Čihař <michal@cihar.com>