Implementation of the rename operation.