How to write the code more professional? (duplication in code)

Printable View