@classmethod
def sync(cls, site, force_insert=False):
    """
        Create or synchronize Alias object from ``site``.

        If `force_insert`, forces creation of Alias object.
        """
    domain = site.domain
    if not domain:
        cls._sync_blank_domain(site)
        return
    if force_insert:
        alias = cls.objects.create(site=site, is_canonical=True, domain=domain)
    else:
        alias, created = cls.objects.get_or_create(site=site, is_canonical=
            True, defaults={'domain': domain})
        if not created and alias.domain != domain:
            alias.site = site
            alias.domain = domain
            alias.save()
    return alias
