Refactored commands, should not affect funcionality

 * Moved common code for sync_schemas and migrate_schemas into common.py

 * No need to call .count() on sync_shemas(). They will iterated through
   anyway. If there is no_tenant, `if all_tenants` evaluate False immediately.

 * no need to call .all() after .exclude(). It's already a queryset.

 * about self.stdout.write:
   https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

 * made some small cosmetic changes