MB-9307: Refactor resetting of group

Refactor the resetting of a group based on a state. This
is needed by some later commit.

Change-Id: I5f92fa22522e174fa1ab9bc9658b79845e5512ef
Reviewed-on: http://review.couchbase.org/31301
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>