public IApiResult Create(CreateUser operation) { //check if userName and email exist GetUsers loadUser = new GetUsers(); loadUser.LangID = 1; var loadUserResult = loadUser.QueryAsync().Result; List <User> users = (List <User>)loadUserResult; bool emailExist = users.Exists(user => user.Email == operation.Email); if (emailExist) { return new ApiResult <object>() { ErrorMessageEn = ApiResult <object> .ApiMessage.exist } } ; bool userNameExist = users.Exists(user => user.UserName == operation.UserName); if (userNameExist) { return new ApiResult <object>() { ErrorMessageEn = ApiResult <object> .ApiMessage.exist } } ; var result = operation.ExecuteAsync().Result; if (result is ValidationsOutput) { return(new ApiResult <List <ValidationItem> >() { Data = ((ValidationsOutput)result).Errors }); } else { return(new ApiResult <object>() { Status = ApiResult <object> .ApiStatus.Success }); } }