@Override
    public Integer create(String name, Boolean ispublic, String path, Boolean isDir, User user, Boolean isroot, Integer parent_id)
    {
        try
        {
            FileUploaded file = new FileUploaded();
            
            file.setDeleted(Boolean.FALSE);
            file.setIsDir(isDir);
            file.setIsPublic(ispublic);
            file.setName(name);
            file.setPath(path);
            if (parent_id != null && parent_id != 0)
            {
                file.setParent_id(parent_id);
            }
            sessionFactory.getCurrentSession().save(file);
            
            if (parent_id != null && parent_id != 0)
            {
                UserFile userfile = new UserFile();
                userfile.setFile(file);
                userfile.setUser(user);
                userfile.setState(Boolean.TRUE);

                file.getUserFile().add(userfile);
                sessionFactory.getCurrentSession().save(userfile);
            }
            
            Event event = new Event();
            event.setEventAction(1);
            event.setEventDate(new Date());
            event.setFile_id(file.getId());
            event.setUser_id(user.getId());
            
            sessionFactory.getCurrentSession().save(event);
            
            return file.getId();
        }
        catch (Exception e)
        {
            return null;
        }
    }