Refactor code smell duplicate code, use function from common file

1 job for frontend/refactor/duplicate_code in 1 minute and 15 seconds (queued for 1 second)