    # File lib/chef/provider/group/groupmod.rb, line 45
            def manage_group
              if @new_resource.append
                to_add = @new_resource.members.dup
                to_add.reject! { |user| @current_resource.members.include?(user) }

                to_delete = Array.new

                Chef::Log.debug("#{@new_resource} not changing group members, the group has no members to add") if to_add.empty?
              else
                to_add = @new_resource.members.dup
                to_add.reject! { |user| @current_resource.members.include?(user) }

                to_delete = @current_resource.members.dup
                to_delete.reject! { |user| @new_resource.members.include?(user) }

                Chef::Log.debug("#{@new_resource} setting group members to: none") if @new_resource.members.empty?
              end

              if to_delete.empty?
                # If we are only adding new members to this group, then
                # call add_group_members with only those users
                add_group_members(to_add)
              else
                Chef::Log.debug("#{@new_resource} removing members #{to_delete.join(', ')}")

                # This is tricky, but works: rename the existing group to
                # "<name>_bak", create a new group with the same GID and
                # "<name>", then set correct members on that group
                rename = "group mod -n #{@new_resource.group_name}_bak #{@new_resource.group_name}"
                shell_out!(rename)

                create = "group add"
                create << set_options(:overwrite_gid => true)
                shell_out!(create)

                # Ignore to_add here, since we're replacing the group we
                # have to add all members who should be in the group.
                add_group_members(@new_resource.members)

                remove = "group del #{@new_resource.group_name}_bak"
                shell_out!(remove)
              end
            end