Add utility functions and parameter validation.

Add parameter validation for Set-MergeEnvironment.