Often when you must produce a new program or when you must add something to an existing one you will find that it is similar to something you have done before. Or someone in your company did something similar before.
Do not reinvent the wheel every time you need to implement something.
Look through what you or others have programmed before and find what is most similar to what you need now. Copy it and modify the copy. This can save you lots of time.