public static Orchestrators.PatchUserModel ToPatchUserModel(this API.PatchUserInputModel source, string subjectId)
        {
            var target = new Orchestrators.PatchUserModel()
            {
                SubjectId = subjectId
            };

            var properties = new List <KeyValuePair <string, string> >();

            foreach (var item in source.Properties)
            {
                if (item.Value is JArray)
                {
                    var values = item.Value.ToArray();
                    foreach (var value in values)
                    {
                        properties.Add(new KeyValuePair <string, string>(item.Key, NormalizeEmptyString(value.ToString())));
                    }
                }
                else
                {
                    properties.Add(new KeyValuePair <string, string>(item.Key, NormalizeEmptyString(item.Value.ToString())));
                }
            }
            target.Properties = properties.ToLookup(x => x.Key, x => x.Value);
            return(target);
        }
        public async Task <IActionResult> PatchUser(string subjectId, [FromBody] PatchUserInputModel model)
        {
            var patch    = model?.ToPatchUserModel(subjectId);
            var response = await _userOrchestrator.PatchUserAsync(patch);

            if (response.Content is Models.User)
            {
                response.Content = (response.Content as Models.User)?.ToGetUserViewModel();
            }
            return(response.ToJsonResult());
        }