private void writeCategory(Category category,List<Challenge> challengeList,List<Answer> answerList){
  long oldCategoryId=category.getId();
  category.setId(null);
  long categoryId=mCategoryDataSource.create(category);
  for (int i=0; i < challengeList.size(); i++) {
    Challenge challenge=challengeList.get(i);
    if (challenge != null && challenge.getCategoryId() == oldCategoryId) {
      challenge.setCategoryId(categoryId);
      writeChallenge(challenge,answerList);
      challengeList.set(i,null);
    }
  }
}

private void writeCategory ( Category category , List < Challenge > challengeList , List < Answer > answerList ) { long oldCategoryId = category . getId ( ) ; category . setId ( null ) ; long categoryId = mCategoryDataSource . create ( category ) ; for ( int i = 0 ; i < challengeList . size ( ) ; i ++ ) { Challenge challenge = challengeList . get ( i ) ; if ( challenge != null && challenge . getCategoryId ( ) == oldCategoryId ) { challenge . setCategoryId ( categoryId ) ; writeChallenge ( challenge , answerList ) ; challengeList . set ( i , null ) ; } } }
writes a category with their challenges and their answers to the database
