DRY [here same code](https://github.com/Mirantis/fuelweb/pull/1415/files#L3R321) let's extract that in separate module.