def start_broadcasting(request, title, is_public, coordinates = [], categories = [], username = None, password = None):
    u"""
        Checks if title is available name for broadcasting
        returns None on failure or object reserved for broadcasting,
    """
    
    if not title or len(title) < 5:
        return None
    
    stream = {
        'title' : title,
        'is_public' : is_public,
        'user' : None
    }

    # check for username and password
    if username and password:
        try:
            stream['user'] = User.objects.get(username = username, password = password)
        except ObjectDoesNotExist:
            return None
    
    slug = slughifi(title)
    # if slug is unique?
    if Stream.objects.filter(slug = slug).count() == 0:
        new_stream = Stream.objects.create(**stream)
        new_stream.save()
        # add categories
        for category in Category.objects.filter(slug__in = list(categories)):
            new_stream.categories.add(category)
        return {
            'uuid': new_stream.uuid,
            'server': new_stream.server.url,
            'url': new_stream.get_absolute_url(),
        }
    else:
        return None
 def save(self, *args, **kwargs):
     self.slug = slughifi(self.title)
     return super(Stream, self).save(*args, **kwargs)
 def save(self, *args, **kwargs):
     self.slug = slughifi(self.name)
     return super(Category, self).save(*args, **kwargs)