private void saveCollection(){
  List<Collectable> collectables=mAdapter.getCollectables();
  List<String> serverIds=new ArrayList<>(collectables.size());
  for (  Collectable collectable : collectables) {
    serverIds.add(collectable.getGeneratedId());
  }
  mCollection.setCollectedServerIds(serverIds);
  int collectionId=CollectionModel.saveCollection(this,mCollection);
  if (mCreateFilter && collectionId > -1) {
    List<Filter> filters=FilterModel.getFilters(this);
    Filter filter=new Filter();
    filter.setCollectionId(collectionId);
    filter.setName(mCollection.getName());
    filter.setEpisodeStatusIds(new Integer[]{EpisodeStatus.NEW,EpisodeStatus.PLAYED});
    filter.setDownloadStatusIds(new Integer[0]);
    filter.setUserCreated(true);
    filter.setOrder(filters != null ? filters.size() : 0);
    filter.setEpisodesPerChannel(2);
    filter.setDaysSincePublished(FilterModel.DISABLED);
    filter.setEpisodesManuallyAdded(false);
    FilterModel.insertFilter(this,filter);
  }
  finish();
}

private void saveCollection ( ) { List < Collectable > collectables = mAdapter . getCollectables ( ) ; List < String > serverIds = new ArrayList < > ( collectables . size ( ) ) ; for ( Collectable collectable : collectables ) { serverIds . add ( collectable . getGeneratedId ( ) ) ; } mCollection . setCollectedServerIds ( serverIds ) ; int collectionId = CollectionModel . saveCollection ( this , mCollection ) ; if ( mCreateFilter && collectionId > - 1 ) { List < Filter > filters = FilterModel . getFilters ( this ) ; Filter filter = new Filter ( ) ; filter . setCollectionId ( collectionId ) ; filter . setName ( mCollection . getName ( ) ) ; filter . setEpisodeStatusIds ( new Integer [ ] { EpisodeStatus . NEW , EpisodeStatus . PLAYED } ) ; filter . setDownloadStatusIds ( new Integer [ 0 ] ) ; filter . setUserCreated ( true ) ; filter . setOrder ( filters != null ? filters . size ( ) : 0 ) ; filter . setEpisodesPerChannel ( 2 ) ; filter . setDaysSincePublished ( FilterModel . DISABLED ) ; filter . setEpisodesManuallyAdded ( false ) ; FilterModel . insertFilter ( this , filter ) ; } finish ( ) ; }
initiates saving a collection to the database
