'Creates user home and Trash directories if they do not exist and move any orphan documents to home directory
:param user: User object'

def create_user_directories(self, user):

    Directory.objects.filter(name='/', owner=user).update(name=Document2.HOME_DIR)
    (home_dir, created) = Directory.objects.get_or_create(name=Document2.HOME_DIR, owner=user)
    if created:
        LOG.info(('Successfully    created    home    directory    for    user:    %s' % user.username))
    (trash_dir, created) = Directory.objects.get_or_create(name=Document2.TRASH_DIR, owner=user, parent_directory=home_dir)
    if created:
        LOG.info(('Successfully    created    trash    directory    for    user:    %s' % user.username))
    count = 0
    for doc in Document2.objects.filter(owner=user).filter(parent_directory=None).exclude(id__in=[home_dir.id, trash_dir.id]):
        doc.parent_directory = home_dir
        doc.save()
        count += 1
    LOG.info(('Moved    %d    documents    to    home    directory    for    user:    %s' % (count, user.username)))
    return home_dir
