def normalize_namespaces():
        namespaces_usage = defaultdict(int)
        changelogs_with_namespaces = Changelog.objects.exclude(namespace=None)

        for namespace in changelogs_with_namespaces.values_list('namespace', flat=True):
            namespaces_usage[namespace] += 1

        def normalize(namespace):
            lowercased = namespace.lower()
            # here we process only capitalized namespaces
            if namespace == lowercased:
                return

            # if there lowercased is not used at all
            if lowercased not in namespaces_usage:
                return

            lowercased_count = namespaces_usage[lowercased]
            this_count = namespaces_usage[namespace]

            if lowercased_count >= this_count:
                # if num of occurences is equal,
                # prefer lowercased name
                Changelog.objects.filter(
                    namespace=namespace).update(
                        namespace=lowercased)
            else:
                Changelog.objects.filter(
                    namespace=lowercased).update(
                        namespace=namespace)

            del namespaces_usage[namespace]
            del namespaces_usage[lowercased]

        all_namespaces = namespaces_usage.keys()
        all_namespaces.sort()

        for namespace in all_namespaces:
            normalize(namespace)