The function will be re-used by other webhooks too so it's better to move it to its own package. The unit tests are taken from the original implementation with some minor changes. Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>