Extracting un-dry sql to scope for reuse