public async Task<ValidationResult> RegisterUser(RegisterUser model)
        {
            try
            {
                //Check user doesn't already exist
                var user = await _userRepo.Get(x => x.Email == model.Email)
                    .FirstOrDefaultAsync();

                //If the user already exists return the error
                if (user != null)
                {
                    if (user.Email == model.Email)
                        Result.Error = $"A user with the email {model.Email} already exists";
                    //else if(user.DeviceId == model.DeviceId)
                    //    Result.Error = $"A user with the deviceId {model.DeviceId} already exists";

                    Result.Success = false;
                    return Result;
                }

                User newUser = new User
                {
                    Email = model.Email,
                    Name = model.FullName,
                    DeviceId = model.DeviceId,
                    FacebookId = model.FacebookId
                };

                _userRepo.Insert(newUser);
                await SaveChangesAsync();

                //Send Welcome Email?
                //EmailService.SendWelcomeEmail(newUser)

                Result.Success = true;
                return Result;
            }
            catch (Exception ex)
            {
                Result.Error = ex.Message;
                return Result;
            }
        }
        public async Task<IHttpActionResult> Register(RegisterUser model)
        {
            if (!ModelState.IsValid) { return BadRequest(ModelState); }
            
            var result = await _userService.RegisterUser(model);

            if (result.Success)
            {
                int userId = await  _userService.GetUserId(model.FacebookId);

                if (userId == 0)
                {
                    return BadRequest("Error retrieving the UserId.");
                }

                return Ok(userId);
            }

            return BadRequest(result.Error);
        }