Refactor repeated code and added summary.
Refactor repeated code and added summary.

fhir-crucible/crucible_smart_app,fhir-crucible/crucible_smart_app,fhir-crucible/crucible_smart_app,fhir-crucible/crucible_smart_app