* Refactored redundant code in rest endpoints