BS-9193: move Document related code to document plugin.