public bool CloseDoor(int userId) { User user = GetUser(userId); if (user != null) { if (doorLock.Close()) { logs.Add(new Log(DateTime.Now, user, this.DoorStatus())); return(true); } } else { throw new UnAuthorizeUserException("This user is not authorized to control this door"); } return(true); }