public bool Login(string userName, string password, out UserResource user)
        {
            var loginCommand = new LoginCommand()
            {
                Username = userName,
                Password = password
            };

            try
            {
                _repository.Users.SignIn(loginCommand);
            }
            catch (OctopusValidationException)
            {
                user = null;
                return false;
            }
            
            user = _repository.Users.GetCurrent();
            return true;
        }
        private async Task<ApplicationUser> ResolveApplicationUserAsync(UserResource userResource)
        {
            var user = await DbContext.ApplicationUsers.FirstOrDefaultAsync(u => u.UserName == userResource.Username);

            if (user == null)
            {
                user = new ApplicationUser { UserName = userResource.Username, DisplayName = userResource.DisplayName };
                DbContext.ApplicationUsers.Add(user);
                await DbContext.SaveChangesAsync();
            }
            else if (user.DisplayName != userResource.DisplayName)
            {
                user.DisplayName = userResource.DisplayName;
                await DbContext.SaveChangesAsync();
            }

            return user;
        }