minimize repeating statements

Change-Id: I925dd3c1bbb01be98697784f994867e542121d28
Reviewed-on: http://review.couchbase.org/38194
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>
Tested-by: buildbot <build@couchbase.com>