code: public int remove(Model child) {
          if (child == null) { throw new IllegalArgumentException("cannot remove what is null"); }
          if (child.frozen() || child.getId() == null) {
              throw new IllegalArgumentException(
                      "Cannot remove a child that does not exist in DB (either frozen, or ID not set)");
          }
          if (getId() != null) {
  
              MetaModel metaModel = metaModelLocal;
              if (metaModel.hasAssociation(child.getClass(), OneToManyAssociation.class)
                      || metaModel.hasAssociation(child.getClass(), OneToManyPolymorphicAssociation.class)) {
                  child.delete();
                  return 1;
              } else if (metaModel.hasAssociation(child.getClass(), Many2ManyAssociation.class)) {
                  return new DB(metaModel.getDbName()).exec(metaModel.getDialect().deleteManyToManyAssociation(
                          metaModel.getAssociationForTarget(child.getClass(), Many2ManyAssociation.class)),
                          getId(), child.getId());
              } else {
                  throw new NotAssociatedException(getClass(), child.getClass());
              }
          } else {
              throw new IllegalArgumentException("You can only add associated model to an instance that exists in DB. "
                      + "Save this instance first, then you will be able to add dependencies to it.");
          }
      }
docs: Removes associated child from this instance. The child model should be either in belongs to association (including polymorphic) to this model
  or many to many association.
  
  <h3>One to many and polymorphic associations</h3>
  This method will simply call <code>child.delete()</code> method. This will render the child object frozen.
  
  <h3>Many to many associations</h3>
  This method will remove an associated record from the join table, and will do nothing to the child model or record.
  
  <p></p>
  This method will throw a {@link NotAssociatedException} in case a model that has no relationship is passed.
  
  @param child model representing a "child" as in one to many or many to many association with this model.
  @return number of records affected