protected static User createUserFromDBObject(DBObject obj)
    {
        User u = new User();
        u.setIdUser((String)obj.get("idUser"));
        u.setId((ObjectId) obj.get("_id"));
        u.setUsername((String) obj.get("username"));
        u.setDisplayName((String)obj.get("displayName"));
        u.setFirstName((String) obj.get("firstName"));
        u.setLastName((String) obj.get("lastName"));
        u.setDescription((String)obj.get("description"));
        u.setEmail((String)obj.get("email"));
        u.setGender((Integer) obj.get("gender"));
        u.setNationality((String)obj.get("nationality"));
        u.setIdFacebook((String)obj.get("idUser"));
        Object birthDate= obj.get("birthDate");
        if(birthDate!=null &&  obj.get("birthDate").getClass().equals(Date.class))
             u.setBirthDate((Date)birthDate);
        
        u.setAvatar((String)obj.get("avatar"));
        u.setDescription((String)obj.get("description"));
        u.setShareFacebook((obj.get("shareFacebook")!=null ? (Boolean) obj.get("shareFacebook") : false));
        u.setShareTwitter((obj.get("shareFacebook")!=null ? (Boolean)obj.get("shareTwitter"): false));
        u.setEnableNotification(obj.get("enableNotification")!=null?(Boolean)obj.get("enableNotification"): false );
        u.setRole((Integer) obj.get("role"));
        u.setStatus((Integer) obj.get("status"));
        u.setPwdHash((String) obj.get("pwdHash"));
        
        Object activatedOn=(Object)obj.get("activatedOn");
        if(activatedOn!=null && obj.get("activatedOn").getClass().equals(Date.class))
                u.setActivatedOn((Date)obj.get("activatedOn"));
        
        Object lastLoginOn=(Object)obj.get("lastLoginOn");
        if(lastLoginOn!=null && obj.get("lastLoginOn").getClass().equals(Date.class))
                u.setActivatedOn((Date)obj.get("lastLoginOn"));
        
        u.setBadges((List<Integer>)obj.get("badges"));
        u.setFavorites((String) obj.get("favorites"));
        u.setLiked((String)obj.get("liked"));
        u.setCounterCheckIns((Integer)obj.get("counterCheckIns"));
        u.setCounterFriends((Integer)obj.get("counterFriends"));
        u.setCounterBadges((Integer)obj.get("counterBadges"));
        u.setHashBeerlist((String)obj.get("hashBeerlist"));
        u.setHashFriendlist((String)obj.get("hashFriendlist"));
        u.setHashNotificationlist((String)obj.get("hashNotificationlist"));
        return u;
    }