re-factor out some code in replicated_dets for reuse
re-factor out some code in replicated_dets for reuse

Change-Id: I6e74bac378d2feadad6affbf1d97dd9ea58a93e7
Reviewed-on: http://review.couchbase.org/77635
Tested-by: Artem Stemkovski <15a0730a27c69f62ab86f2b6c639fca202166c02@couchbase.com>
Reviewed-by: Aliaksey Artamonau <3c875bcfb3adf2a65b2ae7686ca921e6c9433147@gmail.com>

membase/ns_server,membase/ns_server,membase/ns_server,membase/ns_server,membase/ns_server,membase/ns_server