BAC-1265 moving toJSONObject logic to DatabaseRule class