/// <summary> /// This method returns a User instance if the provided id belongs to one. /// </summary> /// <param name="id">The id of the user</param> /// <returns>An either monad of a User instance or an Error instance</returns> public Either <User, Error> Get(long id) { try { _logger.LogInformation($"New user request with id: {id}"); var user = _burstChatContext .Users .FirstOrDefault(u => u.Id == id); return(user is { } ? new Success <User, Error>(user) : new Failure <User, Error>(UserErrors.UserNotFound())); }