code: public static <T> DBObject getBsonFromObject(T t)
              throws IllegalAccessException, InstantiationException, InvocationTargetException {
          Field[] fields = AnnotationUtils.filterDeepFields(t.getClass());
  
          DBObject bson = new BasicDBObject();
  
          for (Field field : fields) {
              Method method = Utils.findGetter(field.getName(), t.getClass());
              Object object = method.invoke(t);
              if (object != null) {
                  if (Collection.class.isAssignableFrom(field.getType())) {
                      Collection c = (Collection) object;
                      Iterator iterator = c.iterator();
                      List innerBsonList = new ArrayList<>();
  
                      while (iterator.hasNext()) {
                          innerBsonList.add(getBsonFromObject(iterator.next()));
                      }
                      bson.put(AnnotationUtils.deepFieldName(field), innerBsonList);
                  } else if (IDeepType.class.isAssignableFrom(field.getType())) {
                      bson.put(AnnotationUtils.deepFieldName(field), getBsonFromObject((IDeepType) object));
                  } else {
                      bson.put(AnnotationUtils.deepFieldName(field), object);
                  }
              }
          }
  
          return bson;
      }
docs: converts from an entity class with deep's anotations to BsonObject.
  
  @param t an instance of an object of type T to convert to BSONObject.
  @return the provided object converted to BSONObject.
  @throws IllegalAccessException the illegal access exception
  @throws IllegalAccessException the instantiation exception
  @throws IllegalAccessException the invocation target exception