title: Run operations in a group concurrently, but run then run batches of these operations serially
body: <p>Take these to enumeration loops. They enumerate an array of objects and save them. I want each of these to run concurrently, HOWEVER, I want to wait until all of the <code>categoriesMainToSave</code> return before starting on the <code>categoriesSubToSave</code> batch.</p>
  
  <pre><code>    // Save all the categories
      [categoriesMainToSave enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
          CategoryMain* main = (CategoryMain*)obj;
          [[BFClientAPI sharedAPI] createCategoryMain:main withSuccess:^{
  
          } failure:^(NSError *error) {
              NSLog(@"error = %@",error);
  
          }];
  
      }];
  
      [categoriesSubToSave enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
          CategorySub* sub = (CategorySub*)obj;
          [[BFClientAPI sharedAPI] createCategorySub:sub withSuccess:^{
  
          } failure:^(NSError *error) {
              NSLog(@"error = %@",error);
  
          }];
  
      }];
  </code></pre>
  
  <p>I started to try dispatch groups:</p>
  
  <pre><code>        dispatch_group_t groupMain = dispatch_group_create();
  
          [categoriesMainToSave enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
  
              dispatch_group_enter(groupMain);
              CategoryMain* main = (CategoryMain*)obj;
              [[BFClientAPI sharedAPI] createCategoryMain:main withSuccess:^{
                  dispatch_group_leave(groupMain);
  
              } failure:^(NSError *error) {
                  NSLog(@"error = %@",error);
                  dispatch_group_leave(groupMain);
  
              }];
          }];
  
          dispatch_group_notify(groupMain,dispatch_get_main_queue(),^{
              // Repeat dispatch_group pattern with categoriesSubToSave here
          });
  </code></pre>
  
  <p>But then I create a nested effect in <code>dispatch_group_notify</code>. Is there another way to do this?</p>