<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def merge_record_data(self, changes, orig_record=None):
 """This method merges PATCH requests with the db record to ensure no data is lost. In addition, it is also a hook for other fields to be overwritten, to ensure immutable fields aren't changed by a request."""

        current_app.logger.info("Merging request data with db record")
        current_app.logger.debug("orig_record: {}".format(orig_record))
        current_app.logger.debug("Changes".format(changes))
        final_record = changes
        if request.method == 'PATCH':
            final_record = dict(orig_record)
            final_record.update(changes)
        elif request.method == 'PUT':
            if '_id' in orig_record:
                final_record['_id'] = orig_record['_id']
        return final_record