public ActionResult CreateUser(ViewModel.UserinfoViewModel userInfo)
        {
            GenericAjaxResponse <bool> response = new GenericAjaxResponse <bool>();

            try
            {
                if (ModelState.IsValid)
                {
                    if (!userInfo.Role.Equals("admin", StringComparison.OrdinalIgnoreCase) && !userInfo.Role.Equals("user", StringComparison.OrdinalIgnoreCase))
                    {
                        response.Errors.Add("Role can be only admin or user");
                        response.Success = false;
                        return(Json(response));
                    }

                    AHP.Core.DTO.ExternalUserInfo externalUserAccount = new Core.DTO.ExternalUserInfo();
                    //Only subset of properties are to be filled. Since others are maintained internally
                    externalUserAccount.Username   = userInfo.Username;
                    externalUserAccount.Email      = userInfo.Email;
                    externalUserAccount.Firstname  = userInfo.Firstname;
                    externalUserAccount.Lastname   = userInfo.Lastname;
                    externalUserAccount.Role       = userInfo.Role;
                    externalUserAccount.SupplierId = string.Join(",", userInfo.SupplierId.Split(',').Distinct());
                    externalUserAccount.BirthMonth = short.Parse(userInfo.BirthMonth);
                    externalUserAccount.BirthYear  = short.Parse(userInfo.BirthYear);
                    externalUserAccount.ZipCode    = userInfo.ZipCode;
                    externalUserAccount.Company    = userInfo.Company;
                    externalUserAccount.CreatedBy  = Identity.UserName;

                    response = _restClient.CreateUser(externalUserAccount);
                    if (response == null)
                    {
                        response         = new GenericAjaxResponse <bool>();
                        response.Success = false;
                        response.Errors.Add("An error occurred. Please try again.");
                    }
                    else
                    {
                        response.Success = response.Data;
                    }
                }
                else
                {
                    foreach (var modelKey in ModelState.Keys)
                    {
                        response.Errors.AddRange(ModelState[modelKey].Errors.Select(err => err.ErrorMessage));
                    }
                    response.Success = response.Errors.Count == 0;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Errors.Add("Error occurred getting users. Please try again");
                _logger.Info("Could not retrieve users from database. Error " + ex.Message);
            }
            return(Json(response));
        }