public SlideModel set(int location, SlideModel object) {
    SlideModel slide = mSlides.get(location);
    if (null != object) {
      int removeSize = 0;
      int addSize = object.getSlideSize();
      if (null != slide) {
        removeSize = slide.getSlideSize();
      }
      if (addSize > removeSize) {
        checkMessageSize(addSize - removeSize);
        increaseMessageSize(addSize - removeSize);
      } else {
        decreaseMessageSize(removeSize - addSize);
      }
    }

    slide = mSlides.set(location, object);
    if (slide != null) {
      slide.unregisterAllModelChangedObservers();
    }

    if (object != null) {
      object.registerModelChangedObserver(this);
      for (IModelChangedObserver observer : mModelChangedObservers) {
        object.registerModelChangedObserver(observer);
      }
    }

    notifyModelChanged(true);
    return slide;
  }
  public void add(int location, SlideModel object) {
    if (object != null) {
      int increaseSize = object.getSlideSize();
      checkMessageSize(increaseSize);

      mSlides.add(location, object);
      increaseMessageSize(increaseSize);
      object.registerModelChangedObserver(this);
      for (IModelChangedObserver observer : mModelChangedObservers) {
        object.registerModelChangedObserver(observer);
      }
      notifyModelChanged(true);
    }
  }
  //
  // Implement List<E> interface.
  //
  public boolean add(SlideModel object) {
    int increaseSize = object.getSlideSize();
    checkMessageSize(increaseSize);

    if ((object != null) && mSlides.add(object)) {
      increaseMessageSize(increaseSize);
      object.registerModelChangedObserver(this);
      for (IModelChangedObserver observer : mModelChangedObservers) {
        object.registerModelChangedObserver(observer);
      }
      notifyModelChanged(true);
      return true;
    }
    return false;
  }
  private SlideshowModel(
      LayoutModel layouts,
      ArrayList<SlideModel> slides,
      SMILDocument documentCache,
      PduBody pbCache,
      ContentResolver contentResolver) {
    mLayout = layouts;
    mSlides = slides;
    mContentResolver = contentResolver;

    mDocumentCache = documentCache;
    mPduBodyCache = pbCache;
    for (SlideModel slide : mSlides) {
      increaseMessageSize(slide.getSlideSize());
      slide.setParent(this);
    }
  }