/**
   * Create a SlideModel with exist media collection.
   *
   * @param duration The duration of the slide.
   * @param mediaList The exist media collection.
   * @throws IllegalStateException One or more media in the mediaList cannot be added into the slide
   *     due to a slide cannot contain image and video or audio and video at the same time.
   */
  public SlideModel(int duration, ArrayList<MediaModel> mediaList) {
    mDuration = duration;

    int maxDur = 0;
    for (MediaModel media : mediaList) {
      internalAdd(media);

      int mediaDur = media.getDuration();
      if (mediaDur > maxDur) {
        maxDur = mediaDur;
      }
    }

    updateDuration(maxDur);
  }
 /**
  * Add a MediaModel to the slide. If the slide has already contained a media object in the same
  * type, the media object will be replaced by the new one.
  *
  * @param object A media object to be added into the slide.
  * @return true
  * @throws IllegalStateException One or more media in the mediaList cannot be added into the slide
  *     due to a slide cannot contain image and video or audio and video at the same time.
  * @throws ContentRestrictionException when can not add this object.
  */
 public boolean add(MediaModel object) {
   internalAdd(object);
   notifyModelChanged(true);
   return true;
 }